How would I make the X axis relative to the rotation of the part?

rootJoint.CFrame = CFrame.lookAt(raycast.Position, game.Players.vaviizz.Character.HumanoidRootPart.Position) + Vector3.new(rootJoint:GetAttribute("Distance"), 0, 0)

the “Distance” only applies to the world X and not the local X, if that makes any sense.

you could try doing cframe:VectorToObjectSpace(), i think (?) it might work. if im not wrong it just makes the world axes relative to your cframe’s axes, IF IM NOT WRONG.
also remember that raycasts return nil if they dont hit anything.

other way around:

Cf:PointToWorldSpace(v): takes a Vector V specified in the axes of Cf, and converts it to the space that Cf is defined it. If Cf is the CFrame of a part, that is world space.

Cf:PointToObjectSpace(v): is the inverse of PointToWorldSpace, so it will take a vector specified in the same axes as Cf, and convert it to one specified in the axes of Cf.

One undoes the other, so Cf:PointToObjectSpace(Cf:PointToWorldSpace(v)) == v

VectorToObjectSpace and VectorToWorld space do the same thing but do not consider the position component of Cf.
IIRC: (Cf - Cf.Position):PointToObjectSpace(v) == Cf:VectorToObjectSpace(v)

I wrote a more complete explanation here:
Cube Rotator Mindset

so V would be the vector/rotation the CFrame is relative to?

I would say its the other way around. You can treat the CFrame as if its a function that turns one vector into a position in another space, such as world space.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.