Hello! I have a cannon, attached to a moving truck, which I am trying to point to my mouse.

To do this, I have 2 welds, the first one to control the yaw, and the second one to control the pitch. The first weld is connected to the base, and second connected to the barrel.

To turn the 2 welds c0’s to my mouse I use cframe lookat. But to make sure I only change the yaw/pitch, I do this piece of code:

You’re effectively multiplying two directions which doesn’t do what you think it does unless one of them is close to identity (no rotation at all), which is why it appears to work when pointing forward. You should separately calculate the pitch and yaw rotation. Right now you are calculating a combined rotation and using it twice. You can calculate just a yaw by removing the Y component before doing the lookAt. You can calculate the pitch by replacing the Z component with the length of the X and Y components by themselves. You could also use trigonometry to do each of these but I hate trig because it tempts people to use inverse trig which is almost always used wrong.