Search Unity

3d objects as GUI for first person

Discussion in 'Immediate Mode GUI (IMGUI)' started by Daimon, Nov 19, 2010.

  1. Daimon

    Daimon

    Joined:
    Jul 20, 2010
    Posts:
    32
    i have noticed that many fps games are using some kind of "trick" to let players not move the gun into a wall ect.
    the camera can see this objects (gun or arms) but they will never collide with the scene behind these objects.
    i thought this trick is based on the GUI so i posted it here...
    can somebody help me ? i heard something about diffrent layers for the objects and the camera but thats everything... :(
     
  2. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    Just add another camera. Then set your GUI stuff on an new layer and make your new camera render only that layer. Set the depth of the camera to be higher than that of your main camera.

    This way your GUI is always rendered on top of your game.