Need to limit character rotation vs camera daydream technical preview
I am in the process of creating a google vr app using the daydream technical preview. My game design includes auto forward movement based upon where the user is looking. However, it is not a space game where movement in any direction will work any the user must stay on the ground. The user will however be in a cockpit of sorts, which will always be in view to limit motion sickness. I need to be able to use the horizontal look motion to change the rotation of the character for the forward motion. I would like to have the vertical movement translate into looking up and down in the cockpit, looking down would be a pause button. but the cockpit would always occupy the same horizontal field. I have my vr camera parented by a capsule. I attached this code to the camera to rotate the character:
`Quaternion ori = GvrController.Orientation;
GameObject character;
void Start()
{
character = this.transform.parent.gameObject;
}
void Update()
{
character.transform.localRotation = ori ;
}`
Character movement is attached to the capsule and controlled by:
public float moveSpeed = 5.0f;
void Update()
{
transform.position = transform.position + Camera.main.transform.forward * moveSpeed * Time.deltaTime;
}
This is my first time really using unity so anything will help.
Your answer
Follow this Question
Related Questions
Slerp FPS gun rotation in VR 1 Answer
After upgrading Unity 5.3.3 to 5.4.1 unity is dropping frames. 0 Answers
Update loop not giving accurate Frames Per Second (VR) 0 Answers
Hello guys, I am new with Unity so I would like to ask for your help. 0 Answers
Stop Gun clipping into objects in Google VR (Cardboard) FPS game 1 Answer