# Help with rotation angle please

I want the cannon to rotate around one axis, so that the cannon rotates around the point set in Blender, I rotate exactly children[0]

But there are small dead zones, do you have any idea how to fix it?
The gun turns towards the mouse pointer, the angle is calculated between the car and the point of the mouse cursor on the plane

``````    update
(
turretAngle: number
)
{
let vehicleModel = this.container.getObjectByName('chassis');
if (!vehicleModel) return;

if (rx > 0 && rz > 0)
{
let angle = turretAngle + this.getVehicleModel().rotation.y + MathUtils.degToRad(180);
this.turretModel.children[ 0 ].rotateOnWorldAxis(new Vector3(0, 1, 0).normalize(), angle - this.gunAngle);
this.gunAngle = angle;
}
else if (rx > 0 && rz < 0)
{
let angle = turretAngle + this.getVehicleModel().rotation.z;
this.turretModel.children[ 0 ].rotateOnWorldAxis(new Vector3(0, 1, 0).normalize(), angle - this.gunAngle);
this.gunAngle = angle;
}
}
``````
``````        if (rx > 0 && rz > 0)
{
let angle = turretAngle + this.getVehicleModel().rotation.y + MathUtils.degToRad(180);
this.turretModel.children[ 0 ].rotateOnWorldAxis(new Vector3(0, 1, 0).normalize(), angle - this.gunAngle);
this.gunAngle = angle;
return;

}
else if (rx > 0 && rz < 0)
{
let angle = turretAngle + this.getVehicleModel().rotation.x - this.getVehicleModel().rotation.y + this.getVehicleModel().rotation.z;
this.turretModel.children[ 0 ].rotateOnWorldAxis(new Vector3(0, 1, 0).normalize(), angle - this.gunAngle);
this.gunAngle = angle;
return;
}
``````

This option works, is there an easier way to do this?

I tried to use 3 possible options:

I have a tank that has a cannon attached to it

1.

``````        let modelGun = gun;
const baseChildren = [...modelGun.children]

for(const _child of baseChildren)
{
if(_child instanceof Mesh)
{
_child.geometry.translate(0.16, -0.16, 0)
}
}

this.turretPivot = new Object3D()

this.turretOffset = new Object3D();
this.turretOffset.position.set(-0.08, 0, +0.08);

``````

I set the position of the cannon by turretOffset
But when I set the gun rotation everything breaks
this.turretPivot.rotation.x = vehicleModel.rotation.x
this.turretPivot.rotation.z = vehicleModel.rotation.z
this.turretPivot.rotation.y = myAngle (angle between point/cursor)

2.
Tried to use lookAt(), but the gun goes up or down, I only need to rotate around one axis

The third option is described above, but in some positions of the tank, the gun does not rotate correctly

I found an ideal way to rotate an object towards the mouse cursor without using the lookAt () functions, provided that with any rotation of the tank, all 3 rotation coordinates change

And most importantly, this method takes into the 3D cursor that I set in Blender
That is, I do not create additional 3D objects and support points in the tree.js