So I have an arbitrary vector3 direction Vector3.new(1, 0.5, 0)
How would I change HumanoidRootPart.RootJoint.C0 to face that direction? I tried using C0 = CFrame.lookAt(hrp.Position, hrp.Position + direction) but that didn’t really give me the result I wanted.
Is this close to what you want your player to do? robloxapp-20220713-2001549.wmv (747.6 KB)
( Sorry if the video quality is buggy btw. )
here is the script:
wait()
local character = script.Parent
local torso = character:WaitForChild('HumanoidRootPart')
local Direction = Vector3.new(0, 0, 0) -- Vector3.new(X, Y, Z)
torso.Orientation += Direction
print(torso.Orientation)
Using hrp.CFrame = CFrame.lookAt(hrp.Position, hrp.Position + direction) works on it’s own, but I want to be able to rotate the HRP vertically, as shown here:
The only way I was able to do this was by doing C0 *= CFrame.Angles(math.rad(90), 0, 0). But I’m clueless as to how to convert CFrame.lookAt to CFrame.Angles
That also works, but Humanoids don’t really like the character being rotated vertically (will cause you to fall and ragdoll), that’s why I opted to using RootJoint.C0
This isn’t the greatest, but the previous methods I tried using were affected a lot by the HumanoidRootPart’s orientation, so I just straight up made the player unable to rotate it. I’d recommend finding another way to do this without having to disable rotation though, but this should work for now