- Home /
Question by
unity_XY9GfkpHMyaikw · Feb 28, 2019 at 07:32 AM ·
touchaugmented-realityrotation axislean
ARCore - Lean touch- Use Lean Custom Rotation script to limit the rotation only in Y axis
I am trying to limit the rotation only to the y-Axis i.e I want the object to only rotate around it self in y-axis. But I am not able to do this. Please help to solve this issue. Thanks in advance.
Comment
Answer by VIVENKUMAR · Jun 22, 2020 at 04:51 AM
Use this script
public class Rotate : MonoBehaviour { public float rotationSpeed = 0.7f;
[System.Obsolete]
void OnMouseDrag()
{
float XaxisRotation = Input.GetAxis("Mouse X") * rotationSpeed;
// float YaxisRotation = Input.GetAxis("Mouse Y") * rotationSpeed;
// select the axis by which you want to rotate the GameObject
transform.RotateAround(Vector3.down, XaxisRotation);
// transform.RotateAround(Vector3.right, YaxisRotation);
}
Do rem to put a box collider on the game object u want to rotate else it would not work.
Your answer
Follow this Question
Related Questions
How to scale objects individual with pinch zoom in ARCore and set a Min/Max scale? 1 Answer
Augmented reality - LeanTouch/Lean Touch - What to do with multiple objects & how to reset position 1 Answer
Interacting with models in AR 0 Answers
Cloud recognition in Vuforia 0 Answers
Help with LeanTouch not working 0 Answers