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