Forum Discussion

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

OVRPlayerController Moving Platform Support

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:

8 Replies

Replies have been turned off for this discussion
  • Can you upload a simple demo that illustrates the problem?

    I can have one of the devs here take a look at it. Thanks.
  • 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!!!
  • 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.
  • 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.
  • yogee's avatar
    yogee
    Honored Guest
    how can i assign OVRCamera as a unity3d 3rd person camera
  • 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)
  • vajra3d's avatar
    vajra3d
    Honored Guest
    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.