Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Frank1200's avatar
Frank1200
Honored Guest
11 years ago

Prevent Sub-Ordinated Spheres from Rotating with OVR Cams

I have 2 spheres, each textured with a spherical picture for the left and the right eye. Each sphere is arranged under its according left resp. right OVR (Oculus VR), so to look around in a Stereo-360-Spherical-Picture or Movie.



Now i need to prevent the spheres from rotating, so the user can watch around in the scene.
I have a code that worked for me in a non-OVR scene, but don't do for OVR.
What's the code to be instead ?



Thx for help.
Frank

4 Replies

Replies have been turned off for this discussion
  • drash's avatar
    drash
    Heroic Explorer
    I would suggest instead pulling those spheres out of the OVRPlayerController hierarchy, and then just having their transform.positions update to be the same as the OVRCameraController's transform.position. Having it exist as part of the world around the player will make it play a bit more nicely with the SDK in my opinion.
  • Hi Drash,
    thx for reply. un-parenting them from the cam would move the cams out of their center in the spheres when moving. They need to be parented under the cams.
    Looking for a code for the spheres to prevent them from rotating. The still should move with the cams, but not rotate.
  • drash's avatar
    drash
    Heroic Explorer
    Fair enough. In that case, you can make a script that sits on each sphere, and these scripts remember their initial rotation in Awake() and then in LateUpdate() just enforce that rotation. To be safe, you could set up the Script Execution Order so that these scripts execute after everything else.

    So, maybe something like:

    var originalRotation : Quaternion;
    var t : Transform;

    function Awake()
    {
    t = transform;
    originalRotation = t.rotation;
    }

    function LateUpdate()
    {
    t.rotation = originalRotation;
    //and whatever else you want to do with position
    }
  • thx that really eorks fine now :))
    only problem i have is that the DirectToRift.exe is not throwing it on the rift display any more. Other DirectToRift.exes do fine and the one with the old rotation script did fine too, not sure why this one is striking so sturdily.
    The settings are not touched. When i place back the old rotation script the problem stays the same. Have restarted the computer, re-built it several times, but still not going to the Rift screen.
    Any idea ?