How can I make my whole body looking to the camera direction?

Hey everyone!
I need a bit help. I want to make a script, so that my whole body is looking at the camera direction. I don’t want that script, where your head can look only from 0 ° to 160 °. Im not very experienced at scripting, because im designing games. I dont found a video so far, talking about this.

1 Like

So like a first person camera?

3 Likes

But with the Y axis, because the player in that game is flying

1 Like

See this is exactly what Im trying to figure out, Im trying to make my character go fully straight when looking down and when looking up also fully straight

This is what you mean right?

1 Like

You would have to use camera manipulation for that. Search it up on the dev hub

1 Like

You get the cframe angles of the camera and put those angles onto the character.

1 Like

Right now I just have a body gyro and parent it to my player’s humanoid root part then I set it’s CFrame like so, but it doesnt fully look down

local Camera = game.Workspace.CurrentCamera

local h = math.huge
local bg = Instance.new("BodyGyro")
bg.MaxTorque = Vector3.new(h,h,h)
bg.D = 0
bg.Parent = hurmp
--- LookVector X,Y,Z is how you move your camera
while game:GetService("RunService").Stepped:Wait() do
	bg.CFrame = hurmp.CFrame * CFrame.Angles(math.rad(Camera.CFrame.LookVector.Y * 100),0,0)
end

2 Likes

Yes, exactly! That was what I have searched for.

1 Like

Yeah Im not sure how to orient the player the whole way down or the whole way up, ive tried mutiplying by more than 100 but then it starts to go weird and buggy

2 Likes

Change the HumanoidRootPart CFrame to its CFrame and use the second parameter to the Camera look vector

Example:

HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, Camera.CFrame.LookVector)

(Note that using CFrame.new(position, lookAt) is a deprecated way to use it, if you want the other way then you would need to check CFrame | Documentation - Roblox Creator Hub for further informations.)

1 Like

This doesnt work, I’ve tried this recently

1 Like

You can simply change the CFrame property of the BodyGyro to the CFrame of the Camera / CurrentCamera.

You’re then able to use this in a loop:

BodyGyro.CFrame = workspace.CurrentCamera.CFrame
2 Likes

Ok so. If you’re using the camera to tilt a person completely up and down will be a bit of a challenge since the camera cant completely look up, even so its best if you make a CFrame between the players camera position and the HumanoidRootPart position like:

HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, (Camera.CFrame + lookVector).p)

This solves looking completely down.

does anybody have an answer for this?