cancel
Showing results for 
Search instead for 
Did you mean: 

Get Camera Rotation and aply to object

fredvicentin
Honored Guest
I'm doing a ship game that the scenario is static on the scene, so I disabled the head tracking orientation of the camera.
I'm using Unity

Now I need to apply this head rotation to an object

I disabled this lines on OVRCameraRig:

	trackerAnchor.localRotation = tracker.orientation;
centerEyeAnchor.localRotation = hmdLeftEye.orientation; // using left eye for now
leftEyeAnchor.localRotation = monoscopic ? centerEyeAnchor.localRotation : hmdLeftEye.orientation;
rightEyeAnchor.localRotation = monoscopic ? centerEyeAnchor.localRotation : hmdRightEye.orientation;


Now I want to apply the tracking to a cube that i will use to determine if the ship go left or right.

I tried this:

Quaternion riftRotation = Quaternion.identity;
if(OVRManager.tracker.GetPose(0, ref riftRotation))
transform.rotation = riftRotation;


But it appears this error:
error CS1501: No overload for method `GetPose' takes `2' arguments


Any idea how to rotate and object without rotating the camera ?
And get this rotation to another object ?

My game is an SpaceInvader Like game
4 REPLIES 4

cybereality
Grand Champion
I have a feeling this is not a good idea. Disabling head-tracking can make users uncomfortable.
AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV

fredvicentin
Honored Guest
I'm just trying to do an experience.

I need to prove to my boss that this realy don't works, hahaha, but he want I try so I need to do this 😞

cybereality
Grand Champion
In Unity 5 you can do something like:

transform.localRotation = InputTracking.GetLocalRotation (VRNode.CenterEye);


On the object you want to rotate.

Then just make all the objects in the scene a child of the CenterEyeAnchor.

Sort of a hack, but may be enough just for a demo.
AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV

daggasoft
Honored Guest
Where is this stuff documented? I find it continually difficult to find up to date SDK info easily enough. I've seen 3-4 different ways to do this that dont work anymore