Rotate a Part relative to its LookVector

I am currently trying to rotate a parts BodyGyro CFrame relative to its LookVector

When I’ve tried referencing its LookVector itself it throws an error expecting a Vector3 and doing what I am currently doing does not rotate it relative to its LookVector

Engine.BodyGyro.CFrame = Engine.BodyGyro.CFrame * CFrame.Angles(math.rad(Engine:GetAttribute("Pitch")), math.rad(Engine:GetAttribute("Yaw")), math.rad(Engine:GetAttribute("Roll")))

That is what I have currently tried and it is of no use to me so far.

the lookvector is a direction vector3, so saying “relative to it’s lookvector” doesn’t make much sense because it’s not a position, it’s a direction. What are you trying to do?

I think CFrames are in world space, so to rotate it relative to how it is facing, you need to convert it to object space.

Look up ToWorldSpace and ToObjectSpace for CFrames

1 Like

Hi there, this is what I am currently trying and it seems to break the X and Y axis aswell. Any idea what I am doing wrong?

Engine.BodyGyro.CFrame = Engine.BodyGyro.CFrame:ToWorldSpace() * CFrame.Angles(math.rad(Engine:GetAttribute("Pitch")), math.rad(Engine:GetAttribute("Yaw")), math.rad(Engine:GetAttribute("Roll")))

Currently what I am trying to do is rotate a part relative to its front face, I said the LookVector as to my knowledge it is a relative position cast as a rotation value, unsure if I am wrong on this.