Search Unity

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Azuline-Studios, Apr 5, 2013.

  1. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    561
    you can remove the body by disabling the mesh render on the player visible body mesh :D
     
  2. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    :DHaha thank you for your answer JIMBOB by chance you do not know how to change the player's hand please?:)
     
  3. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    561
    sorry im not sure, might need new models with animations to change, unless theres a way that just by changing the mesh renderer to your new mesh would work im not sure?

    you can remove or change the colour of the sleeves easily, which wud make it see more of the skin on arms, but hands still have gloves :D
     
  4. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Thank you:cool:
     
  5. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    But it is or to change the color of hand? I look in the FPS , but I can not find the hand.
     
  6. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    561
    should be a material, one for sleeves and one for arms, im not on unity i cant say the proper name of mat, but i think its in same folder as the all the materials with the guns, apples, muzzle flash...
     
  7. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    561
    Hi, i'm trying to setup a sniper scope, so it only enables if i can shoot and not reloading.. it keeps coming up with object not set to a instance.. i tryed with removing the hid in inspector and placing them manually but they disapear when scene starts, but i have referenced them in start function.... this is the script i have is anyone can help thanx :D

    Code (CSharp):
    1. public GameObject sniperScopeUI;
    2.     [HideInInspector]
    3.     public WeaponBehavior WeaponBehaviorComponent;
    4.     [HideInInspector]
    5.     public Ironsights IronsightsComponent;
    6.     [HideInInspector]
    7.     public FPSRigidBodyWalker FPSWalkerComponent;
    8.  
    9.     void Start()
    10.     {
    11.         WeaponBehaviorComponent = GetComponent<WeaponBehavior>();
    12.         IronsightsComponent = GetComponent<Ironsights>();
    13.         FPSWalkerComponent = GetComponent<FPSRigidBodyWalker>();
    14.     }
    15.  
    16.     void FixedUpdate()
    17.     {
    18.         if (WeaponBehaviorComponent.canZoom
    19.             && !IronsightsComponent.reloading
    20.             && !FPSWalkerComponent.hideWeapon)
    21.         {          
    22.             if (Input.GetAxisRaw ("Xbox L Trigger") > 0.1f || Input.GetButton ("Zoom"))
    23.                 sniperScopeUI.SetActive (true);
    24.         }
    25.         else
    26.         {
    27.             sniperScopeUI.SetActive (false);
    28.         }
    29.     }
     
  8. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    SNIPER IS GOOD FOR THIS GAME, maybe developer will put on next update !!!
     
  9. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    46
    I'm using a NPC with personal model, using mecanim. When the character walks, it alternates idle and walk animation. How to solve the problem?

    And above all, why my model don't touch the ground?
     
    Last edited: Dec 15, 2015
  10. SteveRyu

    SteveRyu

    Joined:
    Apr 9, 2014
    Posts:
    121
    Hi guys.
    I want to know,
    Is this compatible in Xbox one?
    There's input for Xbox 360, but I want to know is it working on xbox one too.
     
  11. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    I have a problem with my zombie, it does not move, not even a reaction to the player, I have tried to put its navigation but still nothing. What is the problem? :(
     
  12. SteveRyu

    SteveRyu

    Joined:
    Apr 9, 2014
    Posts:
    121
    Have you baked navmesh?
     
  13. polash

    polash

    Joined:
    Jul 8, 2015
    Posts:
    46
    Need some help with HUD, i try the pixcelcrusher unity gui..but its not working i am missing something..can anyone make a Tutorial video. Thanks in advance
    is it possible to show a weapon text what weapon i am useing ? like this one ...

    Untitled.jpg
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    What's not working in How to Use Unity UI for Ammo Text in Realistic FPS Prefab? I'll update the blog post if necessary. In WeaponBehavior.cs, make sure to edit the correct line number according to the version of RFPS that you're using.
     
  15. polash

    polash

    Joined:
    Jul 8, 2015
    Posts:
    46
    thanks tonyLi fot replay, i dont know were i make mistake..cant find anything, if possible can u make a Tutorial video. useing RFPS - 1.22
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    Here you go!
     
  17. polash

    polash

    Joined:
    Jul 8, 2015
    Posts:
    46
    Thank you very much, u are life saver ... now i know why my UI is not working :D
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    Glad I could help!
     
    Defcon44 likes this.
  19. Bonzotaz1

    Bonzotaz1

    Joined:
    Apr 12, 2014
    Posts:
    77
    Any updates on 1.23? release date?
     
  20. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Update = Last page ... :/

    Release date = nope
     
  21. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Hello, how do you add a texture behind the "AmmoGuiText"? Thank you (forexample a wooden texture and "AmmoGuiText" over and we need when there is not the weapon that so hidden and texture when there is the weapon displays its "AmmoText" and texture from behind)
     
  22. Azuline-Studios

    Azuline-Studios

    Joined:
    Apr 5, 2013
    Posts:
    203
    Hello all, since our last post, a lot of work has been done on the Realistic FPS Prefab. We estimate that release of version 1.23 will be early/mid January. Depending on how smoothly the remaining tasks go, which are:
    • AK, M4, shotgun, pistol, sniper rifle melee attack animations
    • Bow and Arrow animation
    • Some AI additions
    • Update documentation and script comments
    A new webplayer demo is also available to try out. There are a number of new features since our last post:
    • The MP5 now has a melee attack, which can be used by pressing the V key. All weapons will have this attack when animations are finished.

    • The knife and sword can block melee attacks by pressing the zoom/right mouse button. The current setup is only an example, as there will be customizable parameters in the inspector for things like block damage reduction (currently at 100% in the demo), cancelling block if hit or keeping guard up, block range/coverage around player, block of melee and ranged attacks or only melee attacks (sword parry doesn't block arrows/bullets, but a shield does), and attacking from block exits block stance or stays in block stance (for firing with a raised tactical shield or swinging sword with shield raised).

    • Silent takedown/backstab for NPCs that are patrolling or standing watch (not hunting player in wave mode). Melee weapons (knife, katana, flashlight) will change position automatically to indicate when you can perform a takedown on an unaware NPC.

    • Some additional swaying/bobbing of weapon models.
    A known issue in the demo is that the wave spawned zombies will attack patrolling or standing zombies, this is because the waved spawned zombies have a different faction number (set so wave spawned NPCs don't attack each other). Both types of zombies are active in the demo for testing, and probably wouldn't both be present in an actual game.

    We're really excited about these new features for the Realistic FPS Prefab since they open up possibilities for fantasy/medieval type games that have more melee combat. Stealth/spy/ninja gameplay is also more of an option with these new features. We will keep you guys updated as we finish version 1.23, thanks for your patience.


    Sent you a PM, llJIMBOBll. Here's my response if anyone else is interested:

    The subject of weapon projectiles is somewhat complicated by the fact that they've been integrated with our object pooling system. Here is the new code (in blue) that handles spawning the projectile objects that is located in the FireOneShot() method of WeaponBehavior.cs:

    Code (CSharp):
    1.     //fire the number of projectiles defined by projectileCount
    2.     for(float i = 0; i < projectileCount; i++){
    3.       direction = SprayDirection();
    4.       RaycastHit hit;
    5.       GameObject projectile;
    6.       Rigidbody projBody;
    7.  
    8.       if(projectilePoolIndex != 0){//or if your projectile GameObject reference is not null
    9.          projectile = AzuObjectPool.instance.SpawnPooledObj(projectilePoolIndex, mainCamTransform.position + (mainCamTransform.forward * 0.5f), mainCamTransform.rotation) as GameObject;//spawn projectile in front of camera
    10.          projBody = projectile.GetComponent<Rigidbody>();
    11.          projBody.velocity = Vector3.zero;
    12.          projBody.angularVelocity = Vector3.zero;
    13.          projBody.AddForce(direction * projectileForce, ForceMode.Impulse);
    14.          if(projRotUp > 0.0f || projRotSide > 0.0f){//add random spin to projectile
    15.            projBody.maxAngularVelocity = 10;//spin faster than default
    16.            projBody.AddRelativeTorque(Vector3.up * Random.Range(projRotSide, projRotSide * 1.5f));
    17.            projBody.AddRelativeTorque(Vector3.right * Random.Range (projRotUp, projRotUp * 1.5f));
    18.          }
    19.        }else{
    20.         if(meleeSwingDelay == 0){
    21.           //check for ranged weapon hit
    22.           if((Physics.Raycast(origin, direction, out hit, range, bulletMask))
    23.           //code continues with original raycast weapon hit detection...
    Most of the code here relates to setting up the velocity and rotation of the projectile rigidbody, and near the top, the SpawnPooledObj() call should be replaced by a gameObject.instantiate call for your projectile object in the project library. You could also comment out the AddRelativeTorque calls, if you don't need them. This is the main section of our weapon projectile code.


    Neat idea with bushes/foliage hiding the player, Takahama. The highlight on the weapon is due to the previous demo using the 2 camera setup, which still shades weapon models indoors, but doesn't affect highlights. The MP5 materials also have higher smoothness values, so it's more noticeable. We'll look into dimming the highlights along with shading the weapons for the 2 camera setup.


    Sure Ludo97, to remove the body of the player, you can deactivate the VisibleBody object in the FPS Main hierarchy. To change the player's hands, you can either import new models from scratch, or activate the weapon objects and click on the hand models in the 3d view. When you have the mesh selected you can deactivate the object or mesh renderer component to make the hands invisible, and drag your new hand models over the originals to make them children of the original hand models so your new models will still be animated. New weapon models should also be set to layer 8, the Gun layer.


    That looks like a good start llJIMBOBll. The reason you're getting null references is probably because the script is trying to get the WeaponBehaviorComponent reference on the object it is attached to. Unless this is the actual weapon object (then the IronsightsComponent and FPSWalkerComponent will be null) you can try something like if the script is attached to the FPS Player object:

    Code (CSharp):
    1.   IronsightsComponent = GetComponent<Ironsights>();
    2.   FPSWalkerComponent = GetComponent<FPSRigidBodyWalker>();
    3.   WeaponBehaviorComponent = GetComponent<FPSPlayer>().WeaponBehaviorComponent;
    The WeaponBehaviorComponent code should also be in your FixedUpdate() loop, so it stays current with the equipped weapon, since the Start() method only happens once, it will only be set to the weapon that was equipped first. Hope that helps.


    Hi Marcirazzo, I think I sent you an email about this, but here it is in case you didn't see it, or if anyone else is interested:

    When you mention that you have changed the model of the zombie NPC, have you added the model as a child game object under the main game object that has the AI.cs script attached? If so, you need to drag the child object over the Object With Anims field of the AI.cs component, so the AI script knows which object to animate.

    For your second question, you can change the height where the NPC's feet touch the ground either by editing the Base Offset property of the Nav Mesh Agent component, or by increasing the y value of the center property of the capsule collider component attached to the main NPC game object.
     
    Last edited: Dec 23, 2015
    Patico, Takahama, Defcon44 and 2 others like this.
  23. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    561
    Wow! Thank you soo much :D :D :D
     
  24. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    I have a problem I bought UGUImini Map but when I puts the player in home UGUI adapted in the inspector, nothing happens on the mini map, the player does not move, does the problem comes from the FPS Player and when I tried with the Unity3D FPSPlayer of his works, like the problem resolved?
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    I haven't used uGUI Mini Map, but do you need to set up Tags or Layers on the FPS Player or add a special component?
     
  26. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    164
    YAY!!! Thanks for update!
    again i have some questions ._.
    1. Why enemies ignore me when i attack? they react after 3 maybe sometimes 6 seconds ? (Enemy Reaction time ?)
    2. Slope limit changes on prone and crouch positions ?(tested on building's roof :D ) any way to edit it ?
     
  27. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    561
    I got it to work, drag the FPSPlayer component to the slot. I used RFPS so it keeps prefab together and doesnt split up on start
     
  28. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    361
    What is the proper way to enter first person cut scene mode/take away controls? Just disabling input scrip doesn't cut it, cause if character was running when script was disabled, camera will continue to shake and you will hear footsteps. I've tried disabled different combination of scripts, but each combination introduced different set of problems. I've spend hours trying to solve this issue...
     
  29. USTGames

    USTGames

    Joined:
    Feb 24, 2015
    Posts:
    7
    pls guys help with text
     
  30. polash

    polash

    Joined:
    Jul 8, 2015
    Posts:
    46
    you should watch this, everything is here .. thanks to TonyLi to makeing this video
     
  31. USTGames

    USTGames

    Joined:
    Feb 24, 2015
    Posts:
    7
    still not working(
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    The Dialogue System disables these components and deactivates the FPS Weapons GameObject:



    Does that work correctly for you? If it doesn't, please let me know so I can fix it. If it works correctly for you, you can do the same thing for your cutscene mode. In fact, you can just send "OnConversationStart" and "OnConversationEnd" to the FPSPlayer to re-use these components, or copy them and change the Trigger to On Sequence.

    The HUD text prefabs are in RFPSP/Objects/HUD. Expand them and disable the GUI Text component on the child GameObjects:

     
    Azuline-Studios likes this.
  33. Bonzotaz1

    Bonzotaz1

    Joined:
    Apr 12, 2014
    Posts:
    77
    @TonyLi How would i do a health GUI like the ammo one?
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    The easiest way would be to give your Unity UI health Text element a unique name, such as "Player Health Text". Then in HealthText.cs's Start() method, find it by name:
    Code (csharp):
    1. private UnityEngine.UI.Text uiText;
    2.  
    3. void Start() {
    4.     uiText = GameObject.Find("Player Health Text").GetComponent<UnityEngine.UI.Text>();
    5.     ...
    and update it in the Update() method:
    Code (csharp):
    1. void Update (){
    2.     //only update GUIText if value to be displayed has changed
    3.     if(healthGui != oldHealthGui){
    4.         uiText.text = healthGui.ToString();
    5.         ...
    Also disable the old HealthText prefab's GUIText components similarly to how the image in my previous post shows for AmmoText.
     
  35. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    361
    @TonyLi I'm using RFPS 1.21 and I don't have selector script, but I assume it's a part of Dialogue System.

    1. Problem number one is that body will continue to move using physics. This is easily fixed be marking player rigid body as static.

    2. Problem number two is that you can see in this video that camera is shaking a bit. It can be fixed by disabling Camera Kick script, but disabling this script introduced new problem. If I need to forceful move !!!FPS Player with a Camera Kick script disabled, camera will no follow !!!FPS Player.

     
    Last edited: Dec 27, 2015
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    I see what you mean. I'm working on two issues with the Dialogue System integration package:
    1. "Disable" Camera Kick but still allow the camera to follow the player.
    2. Stop the Visible Body script from animating the visible body during conversations.
    The updated package will be for RFPS 1.22, but you should be able to adapt the changes for RFPS 1.21.
     
    Defcon44 likes this.
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    You can download the updated package on the Dialogue System Extras page.

    For RFPS 1.21, import FollowFPSPlayer.cs and the one script in the Editor subfolder. Then comment out the VisibleBody stuff in the editor script.

    If you move the player (FPSPlayer), the camera (and visible body in 1.22) should follow properly.
     
    Gua likes this.
  38. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Seen that speaks about scripts, any tracks for the script of turret? ^^

    I think that the system is not complicated, it is just necessary that when the player press "F" (in the trigger) the movements are deactivated, and the player is moved on a position or it there activate a camera already positioned.

    And the player can leave the turret any time or create a checkcase with "can't leave" and the player can't leave the turret before the end of the event.

    This can be a track :)
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    You could use the Dialogue System's Set Component Enabled On Dialogue Event setup if you're using the Dialogue System in your project.

    Otherwise, what about this: Temporarily deactivate all of the RFPS player GameObjects. Activate the player turret GameObjects.

    When the player is done using the turret, deactivate the player turret GameObjects and reactivate the RFPS player GameObjects.
     
    Defcon44 likes this.
  40. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thanks for the track, i use you'r Dialogue system for my project yes (don't take time to very look how is work ^^) but i go check all this, thanks Tony :)
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    Here's a proof of concept: RFPS_DS_Turret_Concept.unitypackage
    • It imports a scene "Test Turret/Scene".
    • It requires the latest version of the Dialogue System RFPS support package from the Extras page. It only requires the latest support package because that's what I used to set up the FPSPlayer. The turret doesn't actually use anything in the newest package.
    • The turret doesn't do anything except look around. (Your question was about switching between turret camera and RFPS camera.)
    • To leave the turret, press Escape.
    • The components that do the work are on the Turret GameObject.
     
    Azuline-Studios likes this.
  42. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Awesome Tony ! Thank you :D

    I test this right know ^^
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    Remember that the turret doesn't actually do anything. The scene only tests switching between RFPS and a different camera system. In your own project, you'll want to replace the turret with a working turret gun. Then just set it up similarly using the Dialogue System components I used on the proof of concept. If you notice any issues, let me know.
     
  44. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    That works perfectly !

    Just go check how shoot with the turret, reticle, maybe aim i don't know but thank you :D

    Edit: Just a little problem with the Mouse Look of the turret Camera, i don't want the turret rotate to 360 but only 180 (x axis) but that doesn't work :/

    I have wirte 70° but i can't move the turret to 360° :s

     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
    Change:
    • Minimum X: -90
    • Maximum X: 90
     
  46. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    I have try it but the camera can move to 360° :S
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,067
  48. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
  49. Bonzotaz1

    Bonzotaz1

    Joined:
    Apr 12, 2014
    Posts:
    77
    Some of you might remember this post a while back , did anyone achieve what he was talking about with the scopes? if so how? i would like to know
     
  50. USTGames

    USTGames

    Joined:
    Feb 24, 2015
    Posts:
    7
    Thank you very much )
     
unityunity