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

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Deleted User, Apr 5, 2013.

  1. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    Loving the system, can't wait for the newest update.

    I'm assuming that melee robot in the new demo is a Mechanim based skeleton, glad to see the support for Mechanim has improved. Will we see gun holding and firing animations on the skeleton too?

    Also, if I could make one pipe-dream suggestion, it would be VR support, though I understand that would need a substantial rewrite as you need to separate the camera from the gun aiming.

    Keep up the great work!

    Edit: I saw that you are already thinking about VR support, glad to see that. Hopefully the new version will have support for gun firing mechanim based enemies/friendlies.
     
    Last edited: Feb 28, 2016
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    This is more of a design question than a technical question, but why not shoot where the player is looking? This feels more natural to me, and you wouldn't have to separate the camera from gun aiming.
     
  3. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    For simple things like Google Cardboard experiences, I think that would work fine. In fact, I will give that another attempt sometime soon.

    But for full fledged PC VR experiences, separated aiming is a lot more immersive. Assuming you have 3d tracking controllers set up, those will provide a pretty nice aiming experience, and draw you in a lot more.

    It may seem natural to you at first, but after trying it I think you will realize how unnatural it feels having a gun glued to your face.

    Here is an interesting thread on it: https://www.reddit.com/r/oculus/comments/19h6vv/how_will_fps_aiming_work_with_the_rift/
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Good point! I don't have a 3D controller yet. Look-aim has worked best with so far with a gamepad/mouse.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Due to a change in the AI in RFPS 1.22, I had to update the way the Dialogue System for Unity pauses NPCs. Instead of the current instructions on the Dialogue System's RFPS Support page, just add the new "Pause AI On Conversation" component in the updated support package available on the Dialogue System Extras page. This component also has general-purpose PauseAI() and UnpauseAI() methods that you can use for your own purposes, too.
     
    Deleted User likes this.
  6. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    Hi Guys,
    I'm having strange thing, when I check HDR then happened

    Strange Blue Muzleflash and

    Strange BulleMark

    Is there any solution to fix this one?
     
  7. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi :)

    For the muzzle flash check the "Layer" maybe is changed, if not, go in a new scene and add the basic RFPS player and look if the problem is still here.

    Strange impacts :/ i don't know how to fix this :s
     
    QuadMan likes this.
  8. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    how to Add Car enter and exit
     
  9. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Depends on the car asset you are using, I used Edys Vehicle Physics and all I did was disable the RFPS player and attach it to the vehicle, and then enabled the vehicle actor so that I could drive around, then when I got out the vehicle i did the opposite and enabled the RFPS player
     
    Deleted User and Dawar like this.
  10. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
     
    Deleted User and QuadMan like this.
  11. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    Thanks guys. You Saved my time :)
     
    Defcon44 likes this.
  12. fra3yan

    fra3yan

    Joined:
    Feb 24, 2016
    Posts:
    2
    i already play demo it's cool and this kit have many cool asset like ai weapon and player control.
    if I want using this kit for mobile fps in android it's possible?
    if any in asset store will help control in mobile too please tell me...
    thanks.
     
  13. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    Possible, I recommend Control freak asset.
    Really easy to make control for mobile.
     
    TalhaDX and Deleted User like this.
  14. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi, I've made a arrow which fires from a crossbow, the arrow does damage to everything except Ai. Does anyone know why? Thanx
    Code (CSharp):
    1.  
    2. public float speed = 100f;
    3.     public float damage = 150.0f;
    4.     public Texture2D hitmarker;
    5.     public bool isHitEnemy = false;
    6.     public AudioSource otherfx;
    7.     public AudioClip hitmarkerSnd;
    8.    
    9.     void Update ()
    10.     {
    11.         if (GetComponent<Rigidbody>() != null)
    12.         {
    13.             GetComponent<Rigidbody>().AddRelativeForce(0f,0f,speed);
    14.         }  
    15.     }
    16.  
    17.     void FixedUpdate ()
    18.     {
    19.         isHitEnemy = false;
    20.     }
    21.  
    22.     void OnCollisionEnter (Collision collision)
    23.     {
    24.         Collider hit = collision.collider;
    25.  
    26.         switch (hit.GetComponent<Collider> ().gameObject.layer) {
    27.         case 1:
    28.             if (hit.GetComponent<Collider> ().gameObject.GetComponent<BreakableObject> ()) {
    29.                 isHitEnemy = true;
    30.                 hit.GetComponent<Collider> ().gameObject.GetComponent<BreakableObject> ().ApplyDamage (damage);
    31.             }
    32.             break;
    33.         case 13:
    34.             if (hit.GetComponent<Collider> ().gameObject.GetComponent<CharacterDamage> ()) {
    35.                 isHitEnemy = true;
    36.                 hit.GetComponent<Collider> ().gameObject.GetComponent<CharacterDamage> ().ApplyDamage (damage, Vector3.zero, transform.position, null, false);
    37.             }
    38.             break;
    39.         case 9:
    40.             if (hit.GetComponent<Collider> ().gameObject.GetComponent<AppleFall> ()) {
    41.                 hit.GetComponent<Collider> ().gameObject.GetComponent<AppleFall> ().ApplyDamage (damage);
    42.             }
    43.             break;
    44.         case 19:
    45.             if (hit.GetComponent<Collider> ().gameObject.GetComponent<BreakableObject> ()) {
    46.                 isHitEnemy = true;
    47.                 hit.GetComponent<Collider> ().gameObject.GetComponent<BreakableObject> ().ApplyDamage (damage);
    48.             } else if (hit.GetComponent<Collider> ().gameObject.GetComponent<ExplosiveObject> ()) {
    49.                 isHitEnemy = true;
    50.                 hit.GetComponent<Collider> ().gameObject.GetComponent<ExplosiveObject> ().ApplyDamage (damage);
    51.             } else if (hit.GetComponent<Collider> ().gameObject.GetComponent<MineExplosion> ()) {  
    52.                 isHitEnemy = true;
    53.                 hit.GetComponent<Collider> ().gameObject.GetComponent<MineExplosion> ().ApplyDamage (damage);
    54.             }
    55.             break;
    56.         default:
    57.             break;
    58.         }
    59.     }
    60.  
    61.     void OnGUI ()
    62.     {
    63.         if (isHitEnemy == true) {
    64.             GUI.Label (new Rect (Screen.width / 2 - 12, Screen.height / 2 - 16, 32, 32), hitmarker);
    65.             otherfx.pitch = Random.Range (0.96f * Time.timeScale, 1.0f * Time.timeScale);//add slight random value to firing sound pitch for variety
    66.             otherfx.pitch = 1.0f * Time.timeScale;
    67.             otherfx.spatialBlend = 0.0f;
    68.             otherfx.panStereo = 0.0f;
    69.             otherfx.velocityUpdateMode = AudioVelocityUpdateMode.Dynamic;
    70.             otherfx.PlayOneShot (hitmarkerSnd, 0.9f / otherfx.volume);//play fire sound
    71.         }
    72.     }
    73.  
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Is your arrow on a layer that registers collisions with layer 13? Is your AI on layer 13?
     
  16. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi, yeah my Ai are layer 13, not sure about the arrow, but will check as soon as Unity stopped building. :/ Thanx
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    If the collision matrix looks good, then try adding a couple debug lines:
    Code (csharp):
    1. case 13:
    2.     Debug.Log("HIT COLLIDER ON LAYER 13: " + hit.gameObject.name);
    3.     if (hit.gameObject.GetComponent<CharacterDamage> ()) {
    4.         Debug.Log("HIT CHARACTER WITH CHARACTERDAMAGE: " + hit.gameObject.name);
    5.         isHitEnemy = true;
    6.         hit.gameObject.GetComponent<CharacterDamage> ().ApplyDamage (damage, Vector3.zero, transform.position, null, false);
    7.     }
    8.     break;
    Or set a breakpoint at the top of OnCollisionEnter and step through what's happening.
     
    Defcon44 likes this.
  18. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi, Thanx I will try that, my arrow is set to ragdolls and pickups as I wanted to recollect the arrow and it adds back to arrow total. Thinking about it maybe this is the problem?

    Thanx for your help Jimbob
     
  19. Deppex

    Deppex

    Joined:
    May 31, 2015
    Posts:
    21
    Hi
    I have problems with (fade in out)
    As a player die RFPS clone (fade out in) object
    and everything is black only stay UI Canvas on
    foreground that I can see

    It is possible that i UI Canvas also
    make invisible.
    As possible how i do that.

    I also change layer in UI and make self another layer
    nothing helps.

    2016-02-28 (1).png
     

    Attached Files:

  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Add a Canvas Group to your Canvas. Fade the Canvas Group's Alpha value to 0.
     
    Defcon44 likes this.
  21. Deppex

    Deppex

    Joined:
    May 31, 2015
    Posts:
    21
    I have solved
    I set UI layer by weapon camera
    Now I have another problem look at photo
    Canvas must first then gun.

    2016-02-28 (2).png
     
  22. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Looks very nice ;)
     
  23. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Set Canvas layer to like '-100'?
     
  24. Deppex

    Deppex

    Joined:
    May 31, 2015
    Posts:
    21
    Thank you guys
    I resolved
    I set another camera for UI
    and use canvas group to fade in and out
    was not easy but was successful
     
  25. fra3yan

    fra3yan

    Joined:
    Feb 24, 2016
    Posts:
    2
    Thanks sir, I will try
     
  26. Deleted User

    Deleted User

    Guest

    You're right Hormic, that the player model doesn't hold the correct weapons yet. We could add this in the next update, but it would further delay it, so we plan on adding this in the version after the upcoming one. The player model will be animated using Mecanim and have the various animations for player and weapon states. Thanks for your patience.


    Good find Takahama, the NPC aiming code was getting updated to use less layers. It hasn't been fixed in the webplayer preview in this post, but it has in the current version. The smoke effects will be fixed too. Mines have been fixed. The lean range for standing and crouching is a good idea too. Thanks for the feedback!


    The idle weapon bob is located in the Ironsights.cs script. The code looks like this:

    Code (CSharp):
    1. idleX = Mathf.Sin(Time.time * 1.25f) * 0.0005f;
    2. idleY = Mathf.Sin(Time.time * 1.5f) * 0.0005f;
    You can edit the 0.0005f values to increase/decrease the weapon bobbing. We'll make this customizable from the inspector too in the next version.


    The reason the light stays for a few seconds is that the BreakableObject.cs script waits for the breaking particle effect to fade completely before destroying the whole game object. A solution would be to add Destroy(lightObject); or deactivate the light component as the first statement in the DetectBroken() coroutine, outside of the while loop.


    Hi Ludo97, the FPSRigidBodyWalker.cs script detects if there is an obstacle in front of the player, it's possible that there might be an invisible collider extending out past the corner that the script is detecting as an obstacle. If you haven't solved the issue, would you mind sending us an image of the geometry & collider that's causing this? Thanks!


    Good to hear you're enjoying the project Legorobotdude, the robot in the preview demo is using Mecanim animations and we plan on moving all the animations to Mecanim eventually. The Mecanim based NPCs could use any type of animation for attacking, including weapon-holding attacks, we just used the kicking animation because it was what was available in the example. In future versions, there will probably be more varieties of Mecanim animations for NPCs.

    As far as VR goes, it's on our list. The next update adds deadzone aiming, which decouples the weapon aiming direction from the camera look direction, as one of the early steps for full VR support.


    That shouldn't be a problem, as long as the layer of the arrow's collider is also set to collide with the NPC layer in the layer collision matrix. Very close to what we'll be doing when we add arrows too in the upcoming update, nice work :)


    Good job Deppex, we'll be implementing GUIcanvas soon. Your setup looks great!


    Apologies for missing the previous February release estimate for the next update, but some of the melee animations and minor fixes took up some time. We're planning to be finished this month, as all that is left is the bow and arrow animations and updating the docs. You can try the new webplayer demo, which now includes offhand melee attacks for all weapons you can use by pressing V.

    Underwater caustic effects have also been added. The player's holding breath time was increased to 1.5 minutes for testing, and the default will be reduced for final release. Also in the demo, offhand melee attacks aren't allowed underwater if shooting isn't for that weapon, which will be fixed.

    Another new feature which is not present in the demo, is an optional barrel detection system which moves the weapon towards the player to prevent it from clipping with level geometry with the one camera setup. This allows the weapons to be scaled up, receive shadows that are more accurate to weapon size, and to increase the supported scene size using one camera. This is an entirely optional effect, but is there to explore options on how to handle first person weapons, short of writing a custom shader. The 2 camera prefab is also an option, which is a good compromise that allows huge scene sizes and a larger camera near clip plane, which helps with Z fighting.

    Thanks for trying the demo and for your patience as we finish work on the next version.
     
    nixter, QuadMan, Dawar and 4 others like this.
  27. Deppex

    Deppex

    Joined:
    May 31, 2015
    Posts:
    21



    Hi
    I have changed a lot in your scripts
    1. Changing weapons in zoom mode can not because
    I wish sniper zoom with Mouse Wheel
    2. NPC if i am Underwater, they return on spawner position
    3. NPC if i in water and NPC can see me he stays and shoot me dead
    4. NPC if i hide behind stones or something else with collider and
    I stey not on NavMesh, they return on spawner position
    Also NPC in Hunt Player mode return on spawner position

    And much more
    but you can not use it because
    i specific made for my game
    and it is not possible
    used in other games.

    Now i have a strange problem
    with collider trigger
    When I crouch in side collider
    than i can not get up player
    I've watched all scripts
    but i can not find problem.
     
  28. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Im sorry if you mentioned, new comer here... is there an ETA on the new update? Looking forward to picking up what I played in the web demo!
     
  29. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    Dude it says in the post "We're planning to be finished this month, as all that is left is the bow and arrow animations and updating the docs."
     
    RangePlusOne likes this.
  30. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Thanks dude, didn't see it, been pulling too many all-nighters!
     
    llJIMBOBll likes this.
  31. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hahaha me too, not looking forward to updating my game xd, but I know it will be worth it :D
     
  32. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Has anyone used this Tactical AI? I had it working for UFPS, but I can't seem to get it going for Realistic FPS Prefab - just curious if anyone else has had any success?
     
  33. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Hello when the next version ?
     
  34. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    yes I use it working great for Rfps
    I do some modification.
     
  35. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hello, read the last Azuline post :)
     
    Legorobotdude likes this.
  36. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    It is possible to put the system of AI "RFPS" on animals? eg an animal attack me I can kill
     
  37. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    Last edited: Mar 9, 2016
  38. TalhaDX

    TalhaDX

    Joined:
    Feb 2, 2013
    Posts:
    94
    Having trouble setting Control
    Having issues setting Control freak. Can you share the procedure??

    What i am doing right now is:

    1 - Drag the CF-FPP prefab in scene..
    2 - Apply "DEMO FPP charac" script on player,(inside "FPS Main 1 Camera" on FPS Player object)
    3 - Created empty Head and Uper bone object and pass to DEMO FPP charac
    4 - Applied "Character controller" to FPS Player

    if i do not apply character controller it moves but with jerky and is not suitable.

    But if i apply character controller player legs goes in ground and only player goes, camera does not follow.

    PS: I have seen lot of people saying they applied control freak, but someone should have shared the procedure too, even the publisher of RFPS (because they have not given support for mobile yet)
     
  39. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    Nice! Destruction looks awesome!
    Download the InputControl.cs file that I uploaded. Next step will know, and add controller prefab on scene.
    Here's the control freak controller prefab that I made: https://www.dropbox.com/s/daq4wo3rcc3mgu5/CF_RFPS Mobile.prefab?dl=0

    Enjoy! Now lots of games will add on play store.
     

    Attached Files:

    Deleted User and TalhaDX like this.
  40. TalhaDX

    TalhaDX

    Joined:
    Feb 2, 2013
    Posts:
    94
    Thanks, give me few minutes to test it out. And thank you again :)
     
  41. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Hello, I added a UI interface in my game and how when I start the game, the display of the UI interface appears slowly ?
     
  42. TalhaDX

    TalhaDX

    Joined:
    Feb 2, 2013
    Posts:
    94
    And finally i have setup the controls. Thanks. ;)
     
  43. superme2012

    superme2012

    Joined:
    Nov 5, 2012
    Posts:
    207
    Will your FPS system work with webGL?
     
  44. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    superme2012 likes this.
  45. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Hello, I have a problem with underwater effect , I do not track fog and yet it is activated in the " Lightthings " how to solve this problem? thank you

    ( Note that I used the light Unistorm )
     
  46. noori-mehammad

    noori-mehammad

    Joined:
    Oct 27, 2012
    Posts:
    10
    Hello my friends
    I am very happy with this project
    I have a question
    I want a video lesson for enemy SoldierBadNPC ( Even working on a new project )
    I tried to work perfer for SoldierBadNPC but its not moving or shoot
    But it gives me this error
    (
    PC can't find Navmesh:</color> Please bake Navmesh for this scene or reposition NPC closer to navmesh.
    UnityEngine.Debug:Log(Object)
    <SpawnNPC>c__Iterator32:MoveNext() (at Assets/RFPSP/Scripts/AI/AI.cs:254)
    )
    what should I do
    Even personal enemy works
    thanks for all
     
  47. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    Check out these links: https://unity3d.com/learn/tutorials/modules/beginner/navigation/navmesh-baking

    http://docs.unity3d.com/351/Documentation/Manual/Navmeshbaking.html

    You need to bake a Navmesh for your scene, and make sure your enemies are on that Navmesh.
     
  48. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    Bake Navmesh
     
    Defcon44 likes this.
  49. noori-mehammad

    noori-mehammad

    Joined:
    Oct 27, 2012
    Posts:
    10
    I dont understand ( Bake Navmesh )
    How to do it
     
  50. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    Click Windows > Navigation, and click Bake button.