Prevent tilting while using IK lookAt

PS (7:07)
i have learned that IKs are pretty useful not only for legs but also for turrets, so decided to try it out.

but my turret had some problem. the head of the turret would just continuously tilt.

Since i am pretty new at IK stuffs, i couldnt find ways to solve this.

Thanks for the code you currently have, I’m working hard to fix your issue!

3 Likes

probably make it so the Roll axis is never tilted im guessing something like

-- consider CF to be your CFrame (dont actually call it that because that will be )
CF2 = CFrame.fromMatrix(CF.Position,
CF.Rotation.X,--[[set to 0 if its the x axis]]
CF.Rotation.Y,
CF.Rotation.Z--[[set to 0 if its the z axis]]
)

im pretty sure this is terribly wrong but it should work??? i dunno

perhaps you need to add some constraints like the hinge constraint or ball socket constraint to the turret to limit the movement

im using IK because cframe.lookat is slow. wont there be no reason to do so if i use cframe.fromMatrix tho?

CFrame.lookAt is not slow, make the server just hold data such as target, when target changes you can send the new target to client, and make the client use CFame.lookAt to aim at the target

Hello. I have the same problem, have u found a solution yet?