Search Unity

First Person Shooter Considerations

Discussion in 'Editor & General Support' started by drJones, Apr 9, 2006.

  1. drJones

    drJones

    Joined:
    Oct 19, 2005
    Posts:
    1,351
    I'm planning a FPS that has both a story mode a PVP mode. I've been fooling around with the soldier prefab have a two questions:

    -I've serched the net for a while now can't seem to find any standard info on how the basics work, i.e. in the player's view (in story mode) the weapon seems to be a premade movie not a physical model in the scene, is this correct can this be done in unity (by way of a gui texture i would imagine)? but in mutli-player modes there are actual 3d weapon models that you can see the other players holding. also, in some games when a character dies the camera switches to 3rd person view to show the ragdoll effect - was the 3d ragdoll instantiated at that point (with only the player capsule camera existing before) or was it always in the scene just not rendered to the player view? i'm sure developers may approach this differently, but does anyone have any general experience or info regarding this?

    -Unity specific: how does one go about level interaction (such as conveyor belts) with a kinematic model? i've already read these threads:

    http://forum.otee.dk/viewtopic.php?t=1358&highlight=first+person+fps
    http://forum.otee.dk/viewtopic.php?t=1092&highlight=assets

    but they seem to be based on the standard capsule-camera setup, not the animated model which would be neccessary for a 2-player game. i'd like to try work something out myself but i'm not sure what i need to start with to make it operate correctly.
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    In most FPSes the weapon is an actual 3D model (you can see that it's 3D by watching lighting interactions with it in most recent games). However, it is really treated in a bit special way. I guess the model is just weapon plus some hands (up to what can be seen from player's eyes); maybe it's tied (parented) to the camera as well.

    In network game, you just do it the same way for "me" player, and render regular full models for "other" players.

    Regarding switch to 3rd person - well, there is a zillion way of doing this. Probably the easiest one is always having the two representations, and just disabling one of them (e.g. disable renderer) according to situation.
     
  3. drJones

    drJones

    Joined:
    Oct 19, 2005
    Posts:
    1,351
    its funny i never noticed that (it's that way in the new farcry). thanks for the info.
     
  4. elias723

    elias723

    Joined:
    Feb 10, 2006
    Posts:
    178
    As a side topic to this, if I wanted to have my character holding a weapon instead of it hovering, what is the best way to do this in Unity? I have never used the animation on Unity before, but I think I could get the hang of it if you give me some advice. It just seems silly to have my weapons all hovering when my guy should be holding them. This is more important in a multiplayer game, as you have said, and that is what I am in the process of making. Any tips on this would be greatly appreciated.
     
  5. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    We've done that in Intifada...

    Basically, we had a script on the weapon that would copy the position of a named bone to the weapon.

    In start() we find the bone to match against (hand) and store that in a transform... then we do

    Code (csharp):
    1.  
    2. void LateUpdate () {
    3.    transform.position = hand.position;
    4.    transform.rotation = hand.rotation;
    5. }
    6.