Problem with C0

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.

Sorry I’m really terrible at using CFrames :sweat_smile:

same I don’t know if this works but maybe this?

.C0 = CFrame.new(vector3.new(0,0,0)--[[Position]], vector3.new(1,0.5,0)--[[Direction]])

have you tried using the humanoidrootpart only to face that direction instead?

try this

C0 = CFrame.new(hrp.Position, Vector3.new(1, 0.5, 0)

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)

(goes in StarterPlayer, StarterCharacterScripts.)

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

Maybe this?

hrp.CFrame = CFrame.lookAt(hrp.Position, Vector3.new(hrp.Position.X,hrp.Position.Y,hrp.Position.Z) + Vector3.new(0,direction.Y, direction.Z))

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 could work?
Mind that the second argument should be relative to the root part’s position

local default = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
rootJoint.C0 = CFrame.lookAt(default.Position, Vector3.new(1, 0.5, 0)) * default.Rotation

EDIT: Figured after some testing that this wouldn’t work properly, don’t use this

So in my logic, you want the RootPart to face up in the sky? Tell me if im missing something so i can understand and learn more about it.

I guess, I want to be able to make the HRP face any arbitrary direction without any physics/humanoid stuff interfering with the rotation.

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

local default = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0) -- Default CFrame for the RootJoint

humanoid.AutoRotate = false
humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.Position)
rootJoint.C0 = CFrame.lookAt(humanoidRootPart.Position, target).Rotation * default.Rotation