CFraming a Motor6D

I am trying to Cframe the RootJoint (a motor6d) to make the r6 character face a certain Part, but it appears that the CFrames in a motor6D are in local space.

This is a problem because simply CFraming the humanoidRootPart to face the Part works but not when using a motor6d.

Does anyone know how I can use have the same effect but Cframing the joint instead?

You shouldn’t use RootJoint for this as I’m pretty sure camera uses HumanoidRootPart for character movement stuff (character won’t align with the direction you’re walking in).

Rather than doing that, just set the CFrame of the HumanoidRootPart itself.

local Part = ...
local HumanoidRootPart = ...

--// Without modifying x axis rotation
HumanoidRootPart.CFrame = (HumanoidRootPart.CFrame.p, Part.CFrame.p)

--// With modifying it (theres probably a *better* way to do this)
local p = Part.Position * Vector3.new(1,0,1)
p.Y = HumanoidRootPart.Position.Y
HumanoidRootPart.CFrame = (HumanoidRootPart.CFrame.p, p)

2 Likes