I have a playerController script that enables my player to move around and rotate on the y axis while still facing the camera sensors. I also have a grabObject and throwObject scripts that let me pick up a rigidbody and throw it using the touch controller velocity and angular velocity. The problem I’m having is when I rotate my player 180 degree and throw an object.
player rotation function:
private void vrRotateMovement()
{
if (OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickRight))
{
transform.Rotate(0, 90, 0);
}
if (OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickLeft))
{
transform.Rotate(0, -90, 0);
}
}
Whenever I throw an object along the x axis, the object goes the opposite direction my controller is throwing. I believe this is because I’m not rotating the sensors along with the player relative to the world. I can turn my actual body around 180 degrees and the throwing direction of the object is correct, but not when I rotate the player and still facing towards the sensors.
How do I rotate my player and my sensors orientation so I can throw objects in the correct direction while still facing towards the sensors? Any help is greatly appreciated!