I am working on the Google cardboard now, started newly i have exported the scene its working fine.
But i want to move the camera by the user control i want to know is it possible in google card board?
I have tried this walk control using the “transform.Translate” function in this using the "Input.Acceleration " control. But its not working properly and i odnt ge the proper controll.
I’m not sure what you mean. Are you trying to use the phone’s acceleration to determine if the user is walking? You will have a hard time doing that. The phone will constantly accelerate in all directions depending on where the user is looking.
You will have an easier time using the Cardboard magnetic button as a toggle. Try something like this:
i want to move my camera when user doing acceleration like moving forward, back or side direction. According to that i want to translate my camera into the scene.
i tried this line but i am getting the following error message:
“Assets/Scripts/CardBoardMovingCam.cs(30,31): error CS0120: An object reference is required to access non-static member `Cardboard.CardboardTriggered”
Hi guys, i have just found your conversation and hoping now that you could help me.
Currently I am working on a VR-Project with the Cardboard SDK and unity5 at my university. I am a bloody beginner and my goal is to build a VR-Application for Android that allows the User to walk in the direction he is looking when pulling the trigger.
I’ve made a very similar script to work with the gamepad. To use it, create an empty object with a rigidBody and put the Cardboard object into.
//Get the googlecarboard instance + the rigidbody of the gameobject (Put these 2 lines in the Awake())
mHead = (CardboardHead) FindObjectOfType(typeof(CardboardHead));
rb3D = GetComponentInParent<Rigidbody> ();
//Calculate the diff between the cardboard direction and the forward of the parent object
Vector3 forward = transform.forward;
Vector3 vectorHead = new Vector3 (mHead.Gaze.direction.x, 0.0f, mHead.Gaze.direction.z);
float angle = Vector3.Angle (forward, vectorHead);
//Is the angle negative?
Vector3 cross = Vector3.Cross (forward, vectorHead);
if (cross.y < 0)
angle = -angle;
//Get the gamepad inputs
float moveHorizontal = -Input.GetAxis ("Horizontal");
float moveVertical = -Input.GetAxis ("Vertical");
//Rotate the vector of input with the diff between this GameObject + The forward of the Carboard Object
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
movement = Quaternion.Euler (0, angle, 0) * movement;
//Move the object
rb3D.AddForce (movement * speed * 3f);
rb3D.velocity = Vector3.zero;
rb3D.angularVelocity = Vector3.zero;
To make what you want just replace the line getting the gamepad inputs (l. 17-20) by this
Hi!
I’m looking for the same solution for walking (using phone sensors to walk around) but I’m struggle to manage this. If you manage to do this please let me know.