Skip to main content
Up and Coming
October 4, 2014

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
    This topic has been closed for replies.

    4 replies

    Inspiring
    October 4, 2014
    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.
    Titans of Space PLUS for Quest is now available on DrashVR.com
    Frank1200Author
    Up and Coming
    October 4, 2014
    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.
    Inspiring
    October 4, 2014
    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
    }
    Titans of Space PLUS for Quest is now available on DrashVR.com
    Frank1200Author
    Up and Coming
    October 5, 2014
    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 ?