Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  6. Unity 2017.2 beta is now available for download.
    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. nielo

    nielo

    Joined:
    May 13, 2012
    Posts:
    10
    Not sure what the issue was with the weapon switching I mentioned in the previous post, but I've resolved it by removing and re-adding the weapons. Strange, but at least it's better.
     
  2. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    I agree with what nielo is saying. I've modified a few lines of code (mainly the raycasting on the bullet) and I know that this is going to be overwrite with any updates VisionPunk make, would be good if I could write my own classes and inherit a lot of those private variables.

    A couple of feature requests. 1) Holstering a weapon. 2) A way to measure the force when hit the floor when you fall.
     
  3. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @Nielo:

    It's very possible to show multiple weapons that all use the natural movement. I'm planning to make better support for this. Not sure when I can have this done though.

    My thoughts on a flashlight feature: The first thing that comes to mind regarding flashlights is you could use spotlights with light cookies. That way you would be able to do someting like Doom3:



    You have probably been thinking the same :)

    (Actually Doom3 uses the flashlight as a separate weapon. As I recall they got lots of flak for this though).

    If you want a flashlight and a weapon simultaneously, you could modify the SetWeapon code in vp_FPSCamera to use two input parameters (left and right hand weapon), and to make all weapons invisible except these two. You could then make a flashlight weapon model and use it as the left weapon. There could maybe be a flashlight script (instead of vp_FPSShooter) that would use a spotlight with a cookie as explained here: http://unity3d.com/support/documentation/Components/class-Light. This is just my quick take on the setup. Not sure what will work.

    Feel free to send me any code suggestions, or to post code or patch notes here (as long as you don't post the source code of the asset).

    As for inherit override behavior; you are right and I'll take a look at this moving forward.

    Thanks for your feedback.

    /Cal
     
    Last edited: May 19, 2012
  4. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    1.) From script you can do SetWeapon(0); on the vp_FPSCamera to make the weapon disappear. Ofcourse we would like the current weapon to rotate smoothly out of view. I'll have to look into this.

    2.) Check out the public FallImpact property of the vp_FPSController class. This property can be checked every frame to apply falling damage or play impact sounds.
     
  5. nielo

    nielo

    Joined:
    May 13, 2012
    Posts:
    10
    @Cal

    The flashlight itself is luckily not the problem - as you say it's a spotlight with a cookie (and a mesh). I'll dig into SetWeapon and see if I can work around modifying the code too much by using a polymorphic function, thx.

    Perhaps if you create an email address like patches[​IMG]visionpunk.com your community can help you improve Ultimate FPS Camera faster without the risk of exposing your code?

    I'm very keen to contribute when I can and I'm sure others would be too!

    BTW, the game I'm working on and using UFPS in is the port to pc of the Nintendo DS game Dementium 2 - figured you'd like to know that! (I know I would ;) )
     
    Last edited: May 19, 2012
  6. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    Or setup a private forum under visionpunk.com which only buyers of UFPS can discuss features/bug fixes. I have emailed Cal bits and bobs of code which I think will help with future development UFPS. He seems very interested in having a helping hand!
     
  7. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    dotty + nielo: Thanks for the suggestions. I'll keep it in mind when I expand my site in a while.

    nielo, that's actually quite cool (I checked out the DS trailer). I always had a feeling Survival Horror + Ultimate FPS Camera would be a good match :)
     
  8. nielo

    nielo

    Joined:
    May 13, 2012
    Posts:
    10
    I'm having a problem I'm hoping someone else has experienced - not sure if this is UFPS related.

    When the player attacks I wish to play an animation - not really so necessary for the non-melee weapons, since they already animate quite nicely with UFPS (although for the bonesaw or flamethrower for instance I would definitely need an animation running while the user is attacking), but crucial for the melee weapons like the knife/shank and sledge hammer.

    For some reason it's just not doing it! I've been struggling with this all weekend and am at my wit's end. I've placed print calls before and after each animation.Play (originally CrossFade, but hoped Play would work, unfortunately both fail), so I can see that execution of the relevant code does occur. It's just not playing the animation!

    I also had an issue where my weapons weren't being placed on the weapon layer which I resolved by altering vp_FPSWeapon's Awake method so that instead of

    gameObject.layer = vp_Layer.Weapon;
    it now says

    vp_Layer.Set(gameObject, vp_Layer.Weapon, true);

    also did the same in the for loop that follows, although not sure if this is necessary if the recursive parameter is set to true.
     
  9. nielo

    nielo

    Joined:
    May 13, 2012
    Posts:
    10
    Ok, here's what went wrong;

    Instead of creating an empty game object and placing the mesh inside that I used the mesh object itself for the game object. Foolish human!

    Fixed that and now it behaves.
     
  10. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Done that myself a few times :) So now your animations work?
     
  11. BGT

    BGT

    Joined:
    May 21, 2012
    Posts:
    5
    Hi Vision,

    Congrats for such fresh product you developed! I have purchased it already and I would like to know if possible the features planned for future releases.

    Cheers
     
  12. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    BGT, for the next couple of releases I will focus on making a better and more fully featured example script that is "game ready". That is, more solid support for crouching, running, weapon switching, dual weapons, and (the by far most requested feature) a reload concept. I try not to promise too much in advance (it tends to come back and bite me) but rest assured, I'm working on this long term so there will be many more features in the months to come.

    Thanks for buying it!

    /Cal
     
  13. spotdot

    spotdot

    Joined:
    Oct 1, 2011
    Posts:
    19
    Hi Vision,

    And what about ios and android... is that also on your list? :)
     
  14. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Not in the immediate future, but in fact one user (thelastprogrammer) has gotten it to work on iOS already. I got the feeling his scripting changes weren't all that extensive but I may be wrong. Check out the following forum page for some details.
    http://forum.unity3d.com/threads/126886-Ultimate-FPS-Camera-RELEASED/page7
     
    Last edited: May 22, 2012
  15. laapsaap

    laapsaap

    Joined:
    May 1, 2012
    Posts:
    12
    I tried out the demo and read the forum, from what I understand you dont use any animation from the 3D model itself. But is it possible to do so, is this feature there already?

    Our guns have reload, shooting, draw animations etc.
     
  16. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    Yep, you certainly can! This isn't a 'feature' to UFPS, but you can use the standard unity animation system along with UFPS.
     
  17. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Yes. The system is ment to be a complement to regular animations. It simply moves and rotates the weapon model, taking care of walk bob, jumping and falling motions, reaction to shockwaves, recoil etc. Regular animations should be used for reload, out of ammo, hand idle motions etc (i.e everything that takes place "inside" the weapon hand model).

    As dotty said, there is no feature to specifically play an animation on the model (yet). This is very easy with Unity scripting though.

    Combining procedural motion with "traditional animation" results in a neat combo effect where you really can't tell which system does what, and everything just seems more fluid and natural than "regular" animations only.
     
    Last edited: May 22, 2012
  18. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    233
    Looking good VisionPunk! Any ideas for best practices on how we should handle reloading?
     
  19. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Sure, off the top of my head: keep an integer counter for your player and each ammo type in your game. This might be your inventory code or somewhere else where it best suits your code base. Implementation may differ depending on whether or not your game is a singleplayer game, which network solution you're using, how aggressively you want to prevent cheating etc.

    In the script that handles input (for example SimpleScript in my example), poll the counter for the current player + active weapon and only call vp_FPSShooter.Fire if the counter is above zero. If so, also deduct one from the counter. If not, play a dryfire sound. You may also want to check the ammo state every time a shot is fired to play an "out of ammo" animation on your weapon mesh.

    Create a method to refill the ammo counter and bind it to a button. This method should also play a reload animation on the mesh. If your game design has a "mag / clip" concept you may want to check the inventory for that before allowing reload.

    I will provide something for reload soon. Haven't decided yet how fully featured versus open ended it will be. I'm leaning towards open ended since it will keep the system more generic and allow for more different types of gameplay.

    Good to hear from you again Warpzone, it's been a while :)
     
  20. nielo

    nielo

    Joined:
    May 13, 2012
    Posts:
    10
    Yeah, it's working perfectly now, thanks.

    Quick question; do you think the fact that the spotlight of the flashlight is in the weapons layer would cause any lighting issues? Also, do you think the fact that having a collider in the weapon layer would affect the collider's behaviour in any way?

    For the melee weapons I'm attaching a collider to the damaging part of my, say, knife weapon, but for some reason my zombies aren't getting hit! I'm using the same component on the hooks the zombies have for hands, and it seems to be detecting collisions between the zombies' hooks and the player perfectly. I just set a flag when the gameObject is attacking to ensure that the weapon is not damaging otherwise, and have expanded the collider to about 4 times the size in an attempt to make it hit the zombie.

    Not 100% the relevant forum, I know, but since it is related to the FPS Player I figured there's enough relevance to at least ask.
     
  21. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    nielo,

    I have no idea, to be honest.

    Yes possibly, I ran into problems of this sort early on. The character would move in a strange pattern or not all all. It turned out the weapon model had a collider that was blocking the path of the CharacterController. I recently had a similar issue with ejected bullet shells, until I put them in the "Debris" layer (see comment in vp_Layer).

    As for knives, here's a tip: just use a Shooter component and a Bullet prefab with a really short Range. Get rid of the decal mesh on the bullet Gameobject. Replace the impact particle effects with blood particle effects. Replace the impact sounds with gory slashing sounds. I think that would work great. The bullets don't use colliders so they won't interfere with stuff in weird ways.
     
    Last edited: May 24, 2012
  22. Lypheus

    Lypheus

    Joined:
    Apr 16, 2010
    Posts:
    664
    Speaking of ejected bullet shells, I'm having a heck of a time in my own game of getting them to bounce correctly on a mesh collider - your map looks like it uses a mesh collider, how did you get the bullets to not 'fall through' the ground? I've tried attaching a rigidbody to the ground, ensured the collision matrix is right so they should collide, the only way i'm able to get bullets to bounce is by making them Continuous Dynamic - which leads to really odd behaviours ... I must be missing something :).
     
  23. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hey Lypheus,

    Actually they do sometimes fall through the ground in the demo too. I think this is an issue with Unity's collision / physics. Small, fast moving collision objects like the shell casings do have a problem colliding with big polygons in Unity. You could try making the colliders on the shell prefab bigger (though they are already a bit bigger than the visual shells). I don't know the inner workings of the Ageia collision code, but maybe the size of the ground polygons plays a role.

    In my demo level the ground and walls are split into pretty small squares, and the shells seem to collide fine against grid terrain, so I guess you could try splitting the ground into smaller polygon segments. I don't think making the ground a rigidbody has much to do with it. It should just have a collider.

    You may have read these threads but if not, they may contain clues:

    http://answers.unity3d.com/questions/131465/inconsistent-collision-detection.html
    http://answers.unity3d.com/questions/52455/issues-with-continuous-dynamic-collision.html
    http://answers.unity3d.com/questions/23737/fast-collision-between-a-mesh-collider-and-a-conti.html
    http://answers.unity3d.com/questions/55179/cheapest-way-to-catch-collisions-on-very-fast-movi.html
     
    Last edited: May 25, 2012
  24. nielo

    nielo

    Joined:
    May 13, 2012
    Posts:
    10
    @Cal

    I was hoping to use the collider as this will give the melee weapons a more natural (and interesting) behaviour, but if I don't succeed over the weekend I'll give your suggestion a try, thanks.

    I'm struggling with another problem though; each time I close my Unity and reopen it the FPSCamera only seems to register a random number (not entirely random, same set of weapons gets registered each time) of the weapons - to solve it I have to remove the weapons from the camera (copy and paste elsewhere then delete the weapons in the camera) and then I have to copy them back before it works again.

    Anyone ever experienced this issue and know what the problem is?
     
  25. urawhat

    urawhat

    Joined:
    May 25, 2012
    Posts:
    13
    @thelastprogrammer could you give us a sample of what you did for the iOS?

    Are you craming the touch event into the array? var touch : Touch = Input.GetTouch(i);
    If it is that easy then I can just comment out the hardcoded keyboard inputs and replace them with the touch input instead.

    Either way, having a iOS version for the vp_FPSCamera to not use this.m_MouseMove.x = Input.GetAxisRaw("Mouse X"); this.m_MouseMove.y = Input.GetAxisRaw("Mouse Y"); and insetad a Vector3 would be awesome!!!

    P.S. @VisionPunk HOLY FREAKING SH@T this is cool.....
     
    Last edited: May 25, 2012
  26. urawhat

    urawhat

    Joined:
    May 25, 2012
    Posts:
    13
  27. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    153
    It is that easy. I just put in my own vector3 instead of input from the mouse. There is nothing else to it. But you have to do that for the camera and the controller, so both scripts must be modified. Also, you're going to have to get the vector3 from the touch input from the player.

    So, there are several control setups in iOS to do just that. I am using just a simple directional pad. The player will touch the directional pad and I would get back a vector3, then plug that vector3 into the two scripts vp_FPSCamera, and vp_FPSController.

    When the player presses 'up' on my directional pad there would be a Vector3.forward passed, and if 'down' is pressed then -Vector3.forward is passed.

    The same vector is sent to both scripts and everything else is taken care of.
     
  28. urawhat

    urawhat

    Joined:
    May 25, 2012
    Posts:
    13
  29. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @urawat, That's really cool. Thanks for sharing :)

    @nielo: are you still having the problem with a random number of weapons appearing? If so, could you provide more detail? Thanks
     
  30. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Check out the new preview video:
     
  31. Yippie

    Yippie

    Joined:
    May 4, 2009
    Posts:
    227
    This is
    Totally
    Awesome XD

    No animation needed <-- I love it best
     
  32. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    Add your own animations through, it works a treat! Looks so good.
     
  33. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,331
    This looks absolutely incredible!


    Kudos to OP, hopefully I will get to use this baby soon!
     
  34. nielo

    nielo

    Joined:
    May 13, 2012
    Posts:
    10
    @Cal

    Yeah, it's still happening and the pressure's getting hectic to finish the player code and move on to the enemies!

    I'm currently going through the changes I made to your code to see if there's anything that could be causing this - nothing so far.

    I can send you the source if you would like to have a look?
     
  35. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    nielo, please email me a detailed decription of the problem with reproduction steps and I'll take a look at it tomorrow (yeah, preferably attach your code changes aswell). Hope we'll get to the bottom of it soon.
     
  36. urawhat

    urawhat

    Joined:
    May 25, 2012
    Posts:
    13
    Coding away and found a slight bug.
    Using the SampleScript
    @Cal
    When you perform a SetWeapon(#); you will sometimes get mutiple weapons showing.

    To recreate it just comment out the switch (weapon) and just add in within the OnGUI
    Code (csharp):
    1.     GUI.Box (new Rect (Screen.width - 95,5,90,60), "");
    2.     if (GUI.Button(new Rect(Screen.width -90,10,80,50),"Gun"))
    3.         {
    4.         SetWeapon(3);
    5.         }
    When you click onto the GUI.button you will get the result.

    Maybe because I did it wrong, but seen this is the unchanged version of the SampleScript.
     
  37. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    734
    I have found the same issue. It fixes itself after selecting another weapon and then back again.

    Also, there seems to be an issue with the audio samples. When you are zoomed in, fire, and then zoom out, the audio gets cut off.
     
  38. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    734
    I was wondering if anyone has written any custom components for this?

    The only thing I can see missing from this, is damage? The ability to send a form of damage that a weapon/bullet could cause?

    I have started doing this myself, but its hard wired into the Bullet system right now. I was wondering if anyone had any ideas as to how to make this into a component style system. Id like to keep this flowing like the rest of the system
     
  39. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @urawhat mimmito: Thx for the bug report. Will look into it.

    @mimminito, The vp_Bullet class will soon be expanded to execute a damage method on the target, probably much in the same way you and dotty have done it. I'm also planning to make many members protected instead of private for easy overriding, as suggested by nielo and dotty.

    Regarding expandability and projectiles in general; the weapons really have no idea what they're firing. They just instantiate gameobjects. I think you can be very creative with component scripts. Just write whatever projectile behavior you like and it can be fired from a weapon.
     
  40. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    734
    Thanks VisionPunk. You got me thinking about Borderlands now :) Sooo many combinations!!!

    Ill carry on with what ive got until you are able to release something. Truly amazing work you have done here, thanks again!
     
  41. urawhat

    urawhat

    Joined:
    May 25, 2012
    Posts:
    13
    @cal Silly Question:
    When the Ultimate FPS Camera is used why is it Any GUITexture are no longer visable?
     
  42. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    urawat, I'm not sure. A quick test shows that it doesn't seem to have anything to do with the camera layers. Note that GUITextures is the oldest of the Unity GUI systems. It might not be in the best of shapes.

    My demoscript uses UnityGUI scripting and that works fine. However, UnityGUI has awful performance, especially on mobile devices. I can recommend NGUI from the asset store (it is on 50% sale now). That system has many cool features and seems to be the one of choice for Unity developers nowadays.

    Cheers
     
  43. proso

    proso

    Joined:
    May 24, 2012
    Posts:
    67
    Great asset!! I've one question. I'm looking for a camera which, besides walking, can hover in the air and can move all directions (by using WASD and mouse direction), so up and down too (Y-value)! Can this asset do that?
     
  44. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hmm, it could definitely be done by modifying the scripts, but Y-movement is not supported out-of-the-box at the moment. Sorry.
     
  45. urawhat

    urawhat

    Joined:
    May 25, 2012
    Posts:
    13
    Now I do not know how the @lastprogrammer did it in his video but I have been kicking my own arse on this.
    @cal you said GUITexture work, but I found no way to get it to work as it always decides to hide itself.

    Here is the issue. I can add in the images such as jump, fire, etc to the screen by doing GUI.DrawTexture but here is the part I am goign nutz over. the input positiion on the mobile will not match the Rect I have placed for the images.

    One touch event matches if I use the Contains(Event.current.mousePosition) but that fails for two fingers on the screen (Mutlti Touch). So anyone know how to get the Touch.position to contain within the two Rect I set up?

    Sample (Removed Ultimate FPS Camera code in this example, but you will get the same results):
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class touch : MonoBehaviour
    5.     {
    6.     public Texture2D jumpicon;
    7.     public Texture2D forwardicon;
    8.     public GUISkin White;
    9.     public int jumpxpos;
    10.     public int jumpypos;
    11.     public int forwardxpos;
    12.     public int forwardypos;
    13.  
    14.     void OnGUI()
    15.         {
    16.         Rect r = new Rect(Screen.width-jumpxpos,Screen.height-jumpypos,32,32);
    17.         GUI.DrawTexture(r, jumpicon);
    18.        
    19.         Rect rforward = new Rect(Screen.width-forwardxpos,Screen.height-forwardypos,32,32);
    20.         GUI.DrawTexture(rforward, forwardicon);
    21.  
    22.         if(Input.touches.Length > 0)
    23.             {
    24.             int i = 0;
    25.             while (i < Input.touchCount)
    26.                 {  
    27.                 Vector2 fingerPos = Input.GetTouch(i).position;
    28.                 if(r.Contains(fingerPos))
    29.                     {
    30.                     Debug.Log("jump");
    31.                     }
    32.                 if(rforward.Contains(fingerPos))
    33.                     {
    34.                     Debug.Log("forward");
    35.                     }          
    36.                 ++i;
    37.                 }
    38.             }
    39.         }
    40.     }
    41.  
    That of tell me why the GuiTextures keeps being hidden. LOL
     
    Last edited: Jun 1, 2012
  46. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,486
    VisionPunk Do you plan to add knife camera movement too, something similar to Call of duty knife attack?
     
  47. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @urawat: I think you misunderstood me. I meant that GUITextures do not work. I'm not sure why. But GUITexture is the oldest and simplest Unity gui system, so I recommend using UnityGUI scripting or NGUI instead.
    http://unity3d.com/support/documentation/Components/GUI Scripting Guide.html
    http://u3d.as/content/tasharen-entertainment/ngui-next-gen-ui/2vh

    Regarding the input issue on mobile. I have seen a few threads discussing problems with this. Here are a couple of examples:
    http://answers.unity3d.com/questions/28344/restricting-ongui-to-test-for-touches-inside-of-a.html
    http://answers.unity3d.com/questions/140025/making-a-gui-texture-tappable-on-iphone.html
     
  48. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @janpec: Don't know yet. Maybe :) Tip: If you can get hold of a knife model and animations you could easily take one of the existing demo presets (for example the mace preset) and modify it to work with your knife content.
     
  49. DeadHope

    DeadHope

    Joined:
    Jun 2, 2012
    Posts:
    2
    Hello I love the product but I was wondering how I can implement it to were if you shoot something it is triggered cause I noticed its not shooting an actual prefab
     
  50. Kinos141

    Kinos141

    Joined:
    Jun 22, 2011
    Posts:
    968
    I just saw this and I have to say, RESPECT.
     
Thread Status:
Not open for further replies.