Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UFPS : Ultimate FPS [ RELEASED ]

Discussion in 'Assets and Asset Store' started by VisionPunk, Mar 9, 2012.

Thread Status:
Not open for further replies.
  1. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    You can upgrade the asset from your Asset Store account. This will work for all future versions of the specific asset. In case you have made modifications to the script files be aware that these will be overwritten, so it is always best to do mods by creating your own classes derived from (inheriting) the existing ones (as opposed to editing the asset scripts directly).
     
  2. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Thanks, yeah Dead Trigger is quite nice. The N.O.V.A. series has great touch controls aswell.
     
  3. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi Vumi, You need to go to the FPSCamera and set the far clipping plane to 15,000 and you will be able to see all objects for UniStorm. Also, check out the last couple of pages in this thread for some additional UniStorm discussion.
     
  4. Wrekk

    Wrekk

    Joined:
    Jul 16, 2012
    Posts:
    51
    Well, it is only when I'm facing certain directions. :s
     
  5. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Which specific directions?
     
  6. calebhc

    calebhc

    Joined:
    Feb 11, 2013
    Posts:
    13
    Hey everyone!

    I managed to get moving platforms working with the Ultimate FPS Camera. I borrowed some code from Unity's Character Motor script and got very basic moving platform support. Now I kept it simple since this is all I require for a game I'm currently building so it doesn't do any player jump velocity re-adjustment or support rotating platforms. If you need more features, check out the Character Motor script and pull from there what you need. The source code for that file may seem a bit scary but just take some time reading through it and it's not so bad. :)

    Anyway, here are the code changes you need to make to the vp_FPSController.cs file.

    In the variable declaration part of the class add these variables:
    Code (csharp):
    1.  
    2. // platform movement
    3. protected Transform m_platform;
    4. protected Vector3 m_playerGlobalPlatformPoint;
    5. protected Vector3 m_playerLocalPlatformPoint;
    6.  
    In the Update method in the class, add this bit of code right before the external forces, motor throttle and fall speed are applied to the moveDirection variable:
    Code (csharp):
    1.        
    2. // Move the player along with the platform
    3. if(MoveWithPlatform()) {
    4.   Vector3 newPlayerGlobalPoint = m_platform.transform.TransformPoint(m_playerLocalP  latformPoint);
    5.   m_Controller.Move(newPlayerGlobalPoint - m_playerGlobalPlatformPoint);
    6. }
    7.  
    Now add this code to the very bottom of the Update method:
    Code (csharp):
    1.  
    2. if(MoveWithPlatform()) {
    3.   m_playerGlobalPlatformPoint = transform.position;
    4.   m_playerLocalPlatformPoint = m_platform.transform.InverseTransformPoint(m_playe  rGlobalPlatformPoint);
    5. }
    6.  
    To always know what platform the player is standing on, add this line to the top in the OnControllerColliderHit method:
    Code (csharp):
    1.  
    2. m_platform = hit.collider.transform;
    3.  
    And FINALLY, add this new method to the bottom of the class:
    Code (csharp):
    1.  
    2. protected bool MoveWithPlatform() {
    3.   return m_Controller.isGrounded  m_platform != null;
    4. }
    5.  
    That's it! Your player should now be able to move on platforms. :) If you any problems or questions/suggestions let me know. Here's a little video demonstrating this: https://vimeo.com/60591696

    - Caleb
     
    Last edited: Feb 27, 2013
  7. Midas89

    Midas89

    Joined:
    Feb 13, 2013
    Posts:
    13
    Is it possible to fire actual projectiles from weapons as it is now? I need to be able to do some collision based detection.

    Projectiles that you can see flying i mean.
     
    Last edited: Feb 26, 2013
  8. Wrekk

    Wrekk

    Joined:
    Jul 16, 2012
    Posts:
    51
    Almost every direction. I can't really go into specifics, sorry. :(

    EDIT: I fixed it! I had to enable Update When Offscreen on my arms. :)
     
    Last edited: Feb 27, 2013
  9. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Looking sweet!

    EDIT: Advanced moving platform support is available in the package as of v1.4.2. See the release notes HERE.
     
    Last edited: May 4, 2013
  10. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Midas, yeah, check out this post for a litte more info.
     
  11. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Glad you got it working :)
     
  12. supericon

    supericon

    Joined:
    Feb 15, 2013
    Posts:
    63
    Thanks for getting back to me. It was failing because it couldn't raycast.

    I fixed it by tweaking the height of the player - it was a bit of a fudge on my part but it works.
     
  13. MattRix

    MattRix

    Joined:
    Aug 23, 2011
    Posts:
    121
    Just posting to say that this thing is *awesome*. I don't have a clue what I'm gonna use it for, but I just spent the past hour making this for some reason: http://struct.ca/games/superfps/001
     
  14. Midas89

    Midas89

    Joined:
    Feb 13, 2013
    Posts:
    13
    First i was like "Nice trees" then the balls hit me in the face. Nice dissperse effect, and the randomness
     
  15. greenmonster

    greenmonster

    Joined:
    Jan 18, 2013
    Posts:
    26
    LMAO, I enjoyed that.
     
  16. Midas89

    Midas89

    Joined:
    Feb 13, 2013
    Posts:
    13
    Thanks a whole bunch. You saved me, while i was looking into it, it seems like i did it right from the beginning when i added my own bullet logic but what i didnt notice was that there was a lot wrong with the collision detection. Bullet had destroy self on collision and it collided with myself so i did not see any projectile. When i debugged it i decided to just offset the bullet spawn point by a bit infront of the camera. It solved my problem and now im back on track again! :D
     
  17. devfo

    devfo

    Joined:
    Jul 24, 2012
    Posts:
    49
    This asset is really great, but I can't just figure out how to make the aiming-down-sight animation, or zoom animation, for it. also, how do i change the reload animation? Could I just use an actual animation that I have?
     
  18. Wrekk

    Wrekk

    Joined:
    Jul 16, 2012
    Posts:
    51
    Just make the bullet ignore collision with the player.
     
  19. Midas89

    Midas89

    Joined:
    Feb 13, 2013
    Posts:
    13
    I tried doing this at first, but i think it has too many meshes, and also its a multiplayer network game so it would be bad if this implementation would make it ignore collisions with other players. However i needed to set an offset anyway in order for it to look good. From other players perspective.
     
  20. Rico21745

    Rico21745

    Joined:
    Apr 25, 2012
    Posts:
    409
    I picked this up last night since it looks pretty interesting. Not sure how much use I'll be able to get out of it, so I figured I'd post here and see VisionPunk's thoughts on it.

    The way I have my camera and game created, its a FPS/TPS camera directly attached to the player's bones to allow them to look down and see their body while in FPS view. I already have damager, weapons, and camera implementations, but I'm wanting to replace my camera with this package's camera since I like the way it animates in general.

    However I'm having some difficulty since it seems like the whole thing is designed around the "limbless player" concept, as well as the fact that my weapons are actually attached to the player mesh (the FPS camera is using the same models as TPS, just attached to a different location/zoom/fov)

    Thoughts?
     
  21. Midas89

    Midas89

    Joined:
    Feb 13, 2013
    Posts:
    13
    You could use separate models, possibly use a mesh without head and upper body. Use the arms separately for the weapons so they can have their own animations depending on what weapon is equipped. That way you can still look down and see your lower body/ legs. I will work on solving it like this when i get there. Also make these meshes only visible for yourself, and then let others see a separate full body mesh, which is hidden from you.
     
  22. devfo

    devfo

    Joined:
    Jul 24, 2012
    Posts:
    49
    Anybody?
     
  23. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    This thread has 54 pages of posts, and you ask about something that has been many many discussed here. Have a look on the previous pages. :p
    I mean, it's impossible to solving your "problem" with a single response.
     
    Last edited: Feb 28, 2013
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Hi,

    If anyone needs to get the UniStorm working with the Ultimate FPS Camera System here's how:

     
  25. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Very cool, thanks for posting.
     
  26. TryHarder

    TryHarder

    Joined:
    Jan 1, 2013
    Posts:
    121
    Hi,

    Ok so I'm at the point of death (for vp_FPSPlayer) that is ;-))

    So I'm wondering before I decide what to do when health gets to 0% I was wondering:-

    1. Is there anything in the new version ??

    2. Has anyone implemented this in a cool way that they'd like to share.


    I'm thinking the 'Player' should drop to the floor etc then fade out the screen

    I've done the screen fade, just not the actual Player death.

    Any ideas, gratefully received.

    Thanks !!
     
  27. Wrekk

    Wrekk

    Joined:
    Jul 16, 2012
    Posts:
    51
    I made my player drop to the floor when dead. It's not hard, just make a Camera and add a collider (I added multiple colliders to make it more realistic) and a rigidbody to it. Make it a prefab, and instantiate it when your player's health <= 0.

    Remember to disable/destroy your player after instantiating.
     
  28. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
  29. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Nice. Thx

    Edit :
    I saw the new V1.4 options. Do you thinked about an option like using a JetPack? I mean, when the feet does not touch the ground?
     
    Last edited: Mar 1, 2013
  30. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    You will be able to tweak your way to a jetpack behaviour using the new jumping parameters in v1.4 I should think.
     
    Last edited: Mar 1, 2013
  31. Wrekk

    Wrekk

    Joined:
    Jul 16, 2012
    Posts:
    51
    Wow, v1.4 sounds amazing! I can't wait! :)
     
  32. Crunch2600

    Crunch2600

    Joined:
    Mar 1, 2013
    Posts:
    5
    Wow, there's a lot of useful info in there. Thanks for making such an awesome package with awesome support and documentation. I know it says Q1 2013, but is there a more solid date for when version 1.4 comes out? Thanks!
     
  33. Midas89

    Midas89

    Joined:
    Feb 13, 2013
    Posts:
    13
    Indeed that's some very good information. Thanks for taking the time to make the FAQ compilation :)
     
  34. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Thanks guys.. and sorry, that's the most exact release window I can give.
     
  35. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Thanks a bunch, BHS. I will implement this in the new FAQ and see what I can do to make things smoother down the road.
     
  36. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi devfo, The zoom motions are done in realtime using spring motions. Read the chapters on Presets and States to learn how it's done. As for your own reload animations: yes, using regular animations is a good idea for reload. See the comments in vp_FPSPlayer.cs to see how to trigger animations on the weapons.
     
  37. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi Rico,

    Check out this FAQ answer. Another thought: you may also want to tone down the flexibility of the camera springs for full-body awareness. When a bomb goes off close by in the demo, the camera actually wobbles several meters away from the character before going back to its original position. This looks cool in first person but if you were looking down on your body it might seem more than a little unrealistic :).
     
  38. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Haha, that totally kicks ass. With art it would be Serious Sam! :). Just great.
     
  39. TryHarder

    TryHarder

    Joined:
    Jan 1, 2013
    Posts:
    121
    Ah Haa, I like it of course a camera with a collider, yes that will work I think I want him to fall backwards left looking at the sky and then fade out, so yep thats great !!

    Thanks for the pointer !!
     
  40. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    Hi VisionPunk. Here's my script
    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4.  
    5. public class vp_Earthquake : MonoBehaviour{
    6.     // demo states
    7.     private int m_ExamplesCurrentSel = 0;           // selection for the 'EXAMPLES' screen
    8.     private TextAsset m_LastLoadedCamera = null;    // used for some demo weapon transition special cases
    9.  
    10.     // player
    11.     public GameObject PlayerGameObject = null;
    12.     private vp_FPSPlayer m_Player = null;
    13.        
    14.     // sounds
    15.     public GameObject m_AudioSource = null;
    16.     public AudioClip m_StompSound = null;
    17.     public AudioClip m_EarthquakeSound = null;
    18.  
    19.     // presets
    20.     public TextAsset ArtilleryCamera = null;
    21.     public TextAsset StompingCamera = null;
    22.     public TextAsset SmackController = null;
    23.  
    24.  
    25.  
    26.     void Start(){
    27.         m_Player = (vp_FPSPlayer)PlayerGameObject.GetComponent(typeof(vp_FPSPlayer));
    28.         m_Player.LockCursor = false;
    29.     }
    30.    
    31.     void Update(){
    32.         if(Input.GetKey(KeyCode.C)){
    33.             PerformEarthquake();
    34.         }
    35.        
    36.         if(Input.GetKey(KeyCode.X)){
    37.             PerformStomp();
    38.         }
    39.     }
    40.  
    41.     private void PerformEarthquake(){
    42.         LoadCamera(StompingCamera);
    43.         m_Player.Controller.Load(SmackController);
    44.         m_Player.Camera.DoEarthQuake(0.1f, 0.1f, 10.0f);
    45.         m_AudioSource.audio.Stop();
    46.         m_AudioSource.audio.PlayOneShot(m_EarthquakeSound);
    47.     }
    48.    
    49.     private void PerformStomp(){
    50.         m_Player.Camera.StopEarthQuake();
    51.         LoadCamera(ArtilleryCamera);
    52.         m_Player.Controller.Load(SmackController);
    53.         m_Player.Camera.DoStomp(1.0f);
    54.         m_AudioSource.audio.Stop();
    55.         m_AudioSource.audio.PlayOneShot(m_StompSound);
    56.     }
    57.  
    58.     private void LoadCamera(TextAsset asset){
    59.         m_LastLoadedCamera = asset;
    60.         m_Player.Camera.Load(asset);
    61.  
    62.     }
    63. }
    64.  

    I'm getting this error
     
  41. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi footprintgames,
    I'm assuming you are using a non-changed vp_FPSCamera script so the line numbers are correct. If so the crash is caused because the 'DoStomp' method in vp_FPSCamera doesn't do a null check when it tries to add force to the CurrentWeapon (which is bad) and the stomp will fail if you don't have a weapon wielded. You can either add a null check on line 864, or if you don't want to modify vp_FPSCamera.cs, in your own script: check that the FPSPlayer's CurrentWeapon property isn't null before calling DoStomp. For more info on how to interpret error messages see this FAQ article.
     
  42. devfo

    devfo

    Joined:
    Jul 24, 2012
    Posts:
    49
    Alright, thx! BTW, would you be able to release some sort of "sneak peak" of some sort for v1.4? That would be great, 'cus I'm really anxious to see the new features, at least a a glance! And bravo for doing a great job on the camera!
     
  43. devfo

    devfo

    Joined:
    Jul 24, 2012
    Posts:
    49
    Also, do you know which variable in Vp_FPSWeapon would change the position of the gun? I need the gun to move to the left a little during the zoom. If you know, that would be great! P.S. Sorry for so many questions :confused:
     
  44. TryHarder

    TryHarder

    Joined:
    Jan 1, 2013
    Posts:
    121
    Hey Guys,

    Finally got my 'bullets' to shoot through my chain link fencing and explode objects beyond, ok so here's how if it helps anyone, don't use Tags, as that just looks like the gun is broken !!

    Do this:-

    First I added a new line to vp_Layer.cs

    // layers
    public const int Weapon = 31;
    public const int Player = 30;
    public const int Debris = 29;
    public const int Props = 28;
    public const int Fencing = 27; THIS ONE HERE
    public const int None = 0;

    Then I added a Layer at 27 in Unity Layers called 'Fencing' and put all my fencing on that layer.

    Then finally changed this line to add the 'or'

    if(Physics.Raycast(ray, out hit, Range, ~((1 << vp_Layer.Player) | (1 << vp_Layer.Debris) | (1 << vp_Layer.Fencing))))

    In vp_Bullet.cs Start()

    Works perfectly :)
     
  45. johnb2

    johnb2

    Joined:
    Feb 13, 2013
    Posts:
    44
    Hello VisionPunk,

    I'm new to Unity and Game Design in general as I'm a modeler and texture guy, but I do have a question that I haven't seen addressed, or I simply missed in the thread here.

    How do I add a PauseMenu script to this?

    What I'd like is:

    When you hit ESC:
    -the game pauses
    -a GUI menu pops up with settings button(s) (I can handle the GUI as I already have one)

    When you hit ESC again, or "Continue" button:
    -the game unpauses and resumes

    If this has already been answered, can someone please point me in the right direction?

    I was originally using this, though modified to various degrees:
    http://forum.unity3d.com/threads/9516-Pause-menu-script-added-to-the-wiki
    http://wiki.unity3d.com/index.php?title=PauseMenu
     
    Last edited: Mar 2, 2013
  46. calebhc

    calebhc

    Joined:
    Feb 11, 2013
    Posts:
    13
    Really, really cool! Thanks for putting this together and I can't wait for version 1.4! :)
     
  47. TryHarder

    TryHarder

    Joined:
    Jan 1, 2013
    Posts:
    121
    Hi,

    Was just wondering, has anyone implemented UFPS movement when hit by an enemy bullet. Approaching this point now and thought I'd ask to save me time experimenting with some camera movement.

    Thanks,
     
  48. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    You don't need to do anything special. Just disable the components on the player when paused and enable them when resumed.
     
  49. michalss

    michalss

    Joined:
    Feb 20, 2013
    Posts:
    5
    How can i create my own gun pls ? I have models and so on, but i want to keep same arms ....
     
  50. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Okay, use a 3d modeling program... This is insane. You've got to do some thinking yourself.
     
Thread Status:
Not open for further replies.