Forum Discussion

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

Integrating OVR prefab in unity survival shooter tutorial

Hey, I've just tried the survival shooter tutorial on unity ( the one with the sleeping kid shooting zombie dolls). I wanted to try change the game view from semi-birds eyes view (with slight rotation) to a first person shooter camera angles, without having to change my camera follow script. Any suggestions on how I might be able to arrange this? and how should my player health canvas layer in the hierachy? I've tried replacing main camera with the OVR camera prefab, and including the same camera follow script(follow player). None of the player health info (HUD canvas) seems to come through the oculus view (tried different arrangements in hierachy).

Thanks for the help! (I can include the files if it helps)
;)

3 Replies

Replies have been turned off for this discussion
  • weasel47's avatar
    weasel47
    Heroic Explorer
    Is the camera itself working now? The HUD will probably need to be on a Worldspace GUI Canvas, and then you can make it a child of the camera.
  • Yea, I've still got the camera looking down and following the player (not changed to first person yet). I've made the canvas world space, but it doesn't seem to be showing (how do you think I should resize it ? or is it a hierachical ordering problem?).

    Also, I'm trying to turn the video perspective as first person. I've currently added mesh colliders to the walls too, so the character can point up and down as well as around itself, but I'm not too sure how I should edit the camera follow script to turn with the character instead of just following it around from above.

    In need of some help from the wise one, Cheers.
  • weasel47's avatar
    weasel47
    Heroic Explorer
    When you're picking a size for the canvas, there are two things to consider. First, what resolution do you want it to be? That's what you have to put in for width and height. The exact size doesn't matter too much, but you could make it something similar to a computer monitor's resolution.
    After that, you need to adjust the transform scale to make it much, much smaller. The exact scale can be adjusted based on how close the canvas will be to the player. If the height is 1000 pixels and you make the scale 0.001, the canvas will appear to be 1-meter tall to the player. If you put it 1 meter in front of the player's face, it will probably not fill the whole view. If you move it closer, it will.
    You can tweak both sets of numbers as you go. Before you go too far with that, you need to figure out why it's not viewable. Before you even worry about the object hierarchy, just stick it somewhere in the 3D space in front of the OVR rig and put some content on it and you should be able to see it. Don't put it inside of anything else in the scene hierarchy.
    Once you can see the canvas, then you can adjust everything and decide what to do with the hierarchy. You might want to make it a direct child of the OVR rig. If so, you can make it a child of the Center Eye Anchor and adjust the position in the Inspector. This is the local position relative to the parent, so 0 for x, 0 for y, and 1 for z would make it always centered in view, 1 meter in front of the player. (It will be able to clip through other objects and disappear, but that's a more complicated issue that I don't have an answer for right now. As far as I know, there's no built-in option for a worldspace canvas to be rendered as an overlay).
    Try all of this and hopefully you'll be on the right track!