# how to convert rotation of an object in degrees X

I need only rotate the x-axis of an object to the mouse or touch, I’m currently using this code to rotate the object:

``````Vector3 screenPoint = new Vector3 (Input.mousePosition.x, Input.mousePosition.y);
screenPoint.z = -transform.position.z; //distance of the plane from the camera
dragObject.parent.LookAt(Camera.main.ScreenToWorldPoint(screenPoint));
``````

But you change x, y, z axes, I want to change only x-axis, or convert the x, y, z in a single angle x. So with y and z to 0 degrees

Does anyone have the same problem and managed to solve it?

I resolved, I put the code I used and I hope to help someone in the future.

``````                            float ris = 0;
if(Object.eulerAngles.y == 270)
{
if(Object.eulerAngles.x <= 90 && Object.eulerAngles.x >= 0) ris = Object.eulerAngles.x + 180;
else ris = Object.eulerAngles.x - 180;
}
else if(dragObject.parent.eulerAngles.y == 90)
ris = -(dragObject.parent.eulerAngles.x - 360);
Debug.Log((int)ris);
``````

Assuming it’s a 3D world, why aren’t you raycasting from the click position to an invisible plane and make it look at that point? This way, the plane defines the rotation.