Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

OVRPlayerController Moving Platform Support

xanderdavisxanderdavis Posts: 87
Hiro Protagonist
edited December 2013 in Unity Development
So I have a hovercraft elevator and without Moving Platform support (as it is included in the default Unity first-person character controller), the OVRPlayerController will not track with a moving platform, instead falling right off (and falling sucks in VR! :P )

Can anyone write a hotfix for this and post it here so everyone can benefit?

It'd be much appreciated!
Cheers
:geek:
Remote Consulting to Clients Worldwide in UI / UX / VR: http://www.xanderdavis.com

Comments

  • cyberealitycybereality Posts: 26,156 Oculus Staff
    Can you upload a simple demo that illustrates the problem?

    I can have one of the devs here take a look at it. Thanks.
    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
  • xanderdavisxanderdavis Posts: 87
    Hiro Protagonist
    Very cool! Built an example demo, attached. You can test between the standard Unity first-person controller and the Oculus controller by simply switching either GameObject on/off, both included in the same Scene.

    http://archive.astrogun.com/oculus-community/platform-example.zip
    (Couldn't get it to attach to this reply, so I uploaded it to the Astrogun site, 22 MB)

    Note: I made the hovercraft platform not only ascend on Y, but also move on X and Z, so we're sure to get moving platform support working for all axis.

    Thanks!!!
    Remote Consulting to Clients Worldwide in UI / UX / VR: http://www.xanderdavis.com
  • cyberealitycybereality Posts: 26,156 Oculus Staff
    OK, here is something to try:

    - Add a "First Person Controller" to the scene.
    - Delete the "Camera" in the "First Person Controller".
    - Copy the "OVRCameraController" from the "OVRPlayerController"
    - Paste the "OVRCameraController" into the "First Person Controller"
    - In the "OVRCameraController" properties, set "Follow Orientation" to "First Person Controller"
    - Make sure the "OVRCameraController" is properly positioned inside the "First Person Controller"

    This will get you about 90% there. It will be missing some of the functionality from the OVR implementation. For example, you can turn your head with the Rift, but the forward movement vector will not change. So you may have to edit the scripts a little to get everything working properly.

    Hope that helps.
    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
  • xanderdavisxanderdavis Posts: 87
    Hiro Protagonist
    I'll give that a try-- thanks!
    Remote Consulting to Clients Worldwide in UI / UX / VR: http://www.xanderdavis.com
  • xanderdavisxanderdavis Posts: 87
    Hiro Protagonist
    Just found an alternate way to make the OVRPlayerController work for this situation-- by using PlayMaker I switched the OVRPlayerController's parent to the GameObject that grouped everything in the platform animation. When the animation completed, I reset the OVRPlayerController's parent to its default. Works perfectly.
    Remote Consulting to Clients Worldwide in UI / UX / VR: http://www.xanderdavis.com
  • yogeeyogee Posts: 4
    how can i assign OVRCamera as a unity3d 3rd person camera
  • CaliberMengskCaliberMengsk Posts: 312
    Hiro Protagonist
    The way I tend to do moving platforms of any type is when I do a grounded check, I set the main player object's parent to the grounded collider's transform, and when there is no collision, remove the parent (parent = null). Won't work in situations where the object rotates (as the player would rotate with it), but it works great for most things like platformers and the like. You can have it work with rotating objects as well by setting the rotations to 0 or whatever angle the player should be at. This even worked in the test room I did where gravity flips upside down at the touch of a button. (rotation upside down but jumping and moving still worked fine even with moving platform.)

    EDIT:
    I should also state that I make the OVRCamera object a child object of an empty game object with a collider on it. The collider moves position and holds the base rotation. Because the OVRCamera is a child, it still inherits the rotation of the gameobject. O-o It's been a while since I've messed with the rift to be honest, but if I recall right, it works fine this way. (may have had to set the follow object thing like said above. I don't remember)
  • vajra3dvajra3d Posts: 134
    Won't work in situations where the object rotates

    I had a similar situation with a rotating platform and was able to come up with a quick and dirty solution that will work if you can't find a better one. Basically you can just add Unity's Character Motor script to the OVRPlayerController and then temporarily enable it (*.enabled=true) with a trigger of some kind and then just disable it at the end of the event. You might want to untick all the unused features (like jump, etc..). It's not ideal but it works.
Sign In or Register to comment.