Question by
Saurav19j · Mar 30, 2021 at 12:51 AM ·
objectrotate objectoculuscontinuous
Rotate object continuously and brake
I am trying to rotate an object in unity using oculus controller. I want to smoothly rotate the object in both the directions (clock and anticlockwise). This is the code I have written but the rotation is not continuous and (-ve) direction is not working.
Code -->
public GameObject target; public float speed; void Update() { if(OVRInput.GetDown(OVRInput.RawButton.X)) {
// Spin the object around the target
transform.RotateAround(target.transform.position, Vector3.up, speed * Time.deltaTime);
}
if (OVRInput.GetDown(OVRInput.RawButton.Y))
{
// Spin the object around the target
transform.RotateAround(target.transform.position, Vector3.down, speed * -Time.deltaTime);
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613031505im_/https://answers.unity.com/themes/thub/images/avi.jpg)