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.
So like a first person camera?
But with the Y axis, because the player in that game is flying
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?
You would have to use camera manipulation for that. Search it up on the dev hub
You get the cframe angles of the camera and put those angles onto the character.
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
Yes, exactly! That was what I have searched for.
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
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.)
This doesnt work, I’ve tried this recently
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
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?