Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

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

  1. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    198
    Ha, ha, ok, will be looking for your email ... You may resend it, i don't think your 1-st email has got through, as well.
     
    Last edited: Feb 2, 2018
  2. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    I cannot express to you how much I appreciate you doing these tutorials w/ text and animated GIFs. Youtube videos are okay, don't get me wrong, but I much prefer this format. Thank you!!!
     
  3. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Those screenshots look amazing. I thought it was DOOM (2017) there for a second. Keep up the good work!
     
  4. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    223
    Hi all,

    I am working back in a level where the player takes a ride in a vehicle (car). This I have gotten to work by hook or by crook and the player can get in the car and drive around. Using Pixel crushers Save System Scene Portal at the end of the level the car drives into the portal and the next scene loads with the Player as normal outside the vehicle so he can continue on on foot. This method as I could not get the Camera Main attached to the car to switch back to the Player otherwise so he can get in and out of the car at will. Though not ideal, that said the method works for the purpose and I can live with that...If anyone has any knowledge of how to allow the Player to do that and could help that would be good but not critical for me?

    While the Player is driving the car through the level however I want him to encounter various obstacles. Collision with things that have a rigid body e.g. walls, movable crates and so on work fine as should . when the car collides with them...Fine....

    More importantly as its a long drive I need to make the level more entertaining and would like to have some enemies shoot at the Car (Player). Now I can get the enemies to do that as they target (shoot at) the Car Rigid Body collider which has the Player Tag and Character Damage script attached, however no damage is applied to the Player...

    I did have it working in earlier versions but it does not know and I cant get the Enemy bullet to register a hit. It seems the Car collider is not being recognised as being the Player and reduce the Player health? I am clearly missing something needed to be attached to my Player object?...

    Anyone know what are the minimum requirements (player elements) a Player object would require in order to register a hit from an Enemy?

    I have a couple of other questions relating to Enemies in this and useful for other scenarios...

    When I drive the Car, if I run into an Enemy unlike a crate the Enemy cannot be knocked aside or damaged by the Car? (they are as a static object and the Car simply stops dead when it collides with them like hitting a brick wall). Can I affect that?

    Lastly can we get an Enemy to damage (destroy) other game objects when their weapon bullet collides with them. e.g. a box (explosive or not)?

    Sorry that's a lot of questions and any help with any of them is appreciated.

    Thanks you.

    Peter
     
  5. TauseefCVS

    TauseefCVS

    Joined:
    Mar 28, 2016
    Posts:
    14
    Hello Guys!
    I am using rfps 1.43 and want to change the 3rd person player character. when changing the character in FPS MAIN, player character disappears, how it can b solve it
     
  6. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    198

    Peter ... for RFPS player driving cars, planes etc: always leave Main Camera object, of the player active. So, this way (driving or not) - player can register hits, and water collisions properly, and water effects as well while driving. You may first need to solve driving and your player first, and than how to do damages. Without a direct look into your project, eg. via TeamViewer, it may take forever. You definitely have the enter exit method for your player still incomplete, or things declared at the wrong sections of the scripts, etc, so it will need direct look into the project, as said, let me know if you want some look i can do that way in your project, and see what can be eliminated form your problems list. Attaching-detaching main camera is easy, we can fix that. (***i will not work on it via emails or overloading the thread here - it's too slow and ineffective ). You can PM me via here, if you wish about that. Michael.
     
  7. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    198

    Check how did you setup (or change) the camera culling and layers of player. Do you have a backup of your player, as it came with the RFPS ? (you should), so try
    to use backup player object in that scene, and inside of new empty scene, both of them - your current player, and the backup player, to see what's going on, first.
    Sometimes , the changes we do a lot to objects and the scene can go unnoticed.
     
  8. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    Hello all!
    im working on TPS mecha game with RFPS base on it
    i replace each robot limb parts over soldier's limbs. But i got that weird issue.. While game is running, there is a duplicate of "Player Character Model" in scene, its FPS soldier model (its invisible in TPS mode. the one without head and arms), but robot parts i added over it is still visible and it causes double limb issue like in picture.
    Does anyone know a way to disable duplicate FPS model? Bug.png

    And when i change stuff to make it disappear, this happens

    Bug2.png
     
    Last edited: Feb 9, 2018
  9. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @Takahama What if you uncheck Skinneed Mesh Renderer in Player Character Model / Mesh 1? Will this help?
     
  10. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    Nope, still same :c
     
  11. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    524
    Have you tried to set your body visibility to false via a script. That might help. Then you could do some sort of a function to control it.

    Code (CSharp):
    1. public bool m_BodyVisible = false;
    2. public Transform m_Body;
    3.  
    4. //Some sort of function
    5. public void myMechFunction()
    6. {
    7.                 m_Body.gameObject.SetActive (m_BodyVisible);
    8. }
     
  12. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    I even deleted Mesh1, but i still get extra pieces i added because they were on limbs of rigged character.
    What i did is; in PlayerCharacter.cs at lines 269/278 i made it look like this

    Code (CSharp):
    1. //scale down arms and head of first person visible body object, so they don't show in the camera view
    2.         if(fpBodyAnim.GetBoneTransform(HumanBodyBones.Head)){
    3.             fpBodyAnim.GetBoneTransform(HumanBodyBones.Head).localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
    4.             fpBodyAnim.GetBoneTransform(HumanBodyBones.RightUpperArm).localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
    5.             fpBodyAnim.GetBoneTransform(HumanBodyBones.LeftUpperArm).localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
    6.             fpBodyAnim.GetBoneTransform(HumanBodyBones.Chest).localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
    7.             fpBodyAnim.GetBoneTransform(HumanBodyBones.LeftUpperLeg).localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
    8.             fpBodyAnim.GetBoneTransform(HumanBodyBones.RightUpperLeg).localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
    9.             fpBodyAnim.GetBoneTransform(HumanBodyBones.Spine).localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
    10.             fpBodyAnim.GetBoneTransform(HumanBodyBones.Hips).localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
    But i believe models still shown in scene, just smaller. it still has load on system which i dont want.. Help is still required.

    Thanks!
     
  13. halo_of_the_sun

    halo_of_the_sun

    Joined:
    Sep 17, 2017
    Posts:
    49
    Found myself coming back to this after spending time on other aspects of the game I'm making. I've tried dozens of tests but can't seem to come up with anything to play a Death Animation for the NPCs, has anyone had any luck with different means?
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    I forgot to mention that you need to remove all rigidbodies but one from the NPC. So your NPC should have only one rigidbody, and only one capsule collider. If it has more than one rigidbody, it will always play a ragdoll death.
     
  15. artistic17

    artistic17

    Joined:
    Jun 12, 2013
    Posts:
    2
    Hey guys am in the process of changing the npc in my game from the default ones to one from the asset store, however it won't work, the animaanim won't play. Help please
     
  16. artistic17

    artistic17

    Joined:
    Jun 12, 2013
    Posts:
    2
    How do you change to mechanim
     
  17. halo_of_the_sun

    halo_of_the_sun

    Joined:
    Sep 17, 2017
    Posts:
    49
    Thanks for the advice! Though I found that I get the error "Can't remove Rigidbody because CharacterJoint depends on it" when I try to remove them. Any thoughts?
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    Remove CharacterJoint, which is used for ragdolls. Since you're ripping out the ragdoll stuff and replacing it with animations, you don't need CharacterJoint.
     
  19. Team_Resurrection

    Team_Resurrection

    Joined:
    Nov 24, 2016
    Posts:
    4
    hey guys, this is my first post up here, I just wanted to ask, I am using the kit and i have added a new weapon, a glock, however it will not allow me to change the animations. any help would be appreciated, thanks :)
    I am using version 1.23
     
  20. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @Moongoose you can use then same animations provided with RFPS, this is what works for me. I haven't tried new animations. What you can do is follow the steps of creating a new weapon by duplicating the 1911 pistol & in the game object where the magazine, slide, & gun model are located, drag the new models into each child object so it inherits the same position as the old model. then in the inspector window just untick MeshRenderer for the 1911 Magazine & Slide mesh, or right click & delete them. this has worked for me every time with all the weapons. Here is a photo showing what im talking about. up top is the regular 1911 opened up & down bottom is a new pistol i added. Hope this helps. RFPS Weapon.png
     
  21. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    576
    Hi all, I'm wondering if anyone has gotten the reload one bullet at a time to work, or edit to code to have a ToStart Reload, ReloadOnce and ReloadLast animation. I tried to look at the code but where rfps isn't modular it's hard to seperate the code its just once big mess of if this and if that.

    Thanx Jim
     
  22. nl2012

    nl2012

    Joined:
    Sep 29, 2017
    Posts:
    17
    Hi

    I have a simple question, i've been working with RFPS for some time now and it's an awesome template.One thing (probrably very easy to do ) is scaling the FPS prefab (i don't use the TPS, disabled it). Is there an easy way (without adjusting coliders and much more). The FPS is to big for standard Unity scaled , doors, hallways ect. Also when using fe a flare on a light, you see it on the light but also a second (duplicate) flare artifact. Thank you in advance.
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    Save System for Realistic FPS Prefab - Version 1.0.6 Released

    Version 1.0.6 of the Save System for Realistic FPS Prefab is now available on the Asset Store. This version adds save support for Compass Navigator Pro and Tactical Shooter AI. It also now encrypts saved games in PlayerPrefs if that where you've configured saved games to go.


    Version 1.0.6 Release Notes:
    • Added Save Current Scene checkbox to Save System.
    • Added encryption when saving to PlayerPrefs.
    • Fixed committing PlayerPrefs changes when minimizing in mobile.
    • Added Compass Navigator Pro support.
    • Added Tactical Shooter AI support.
    Note that the Save System is developed and supported by Pixel Crushers, not Azuline Studios. For support, please post here, or PM me, or post on the Pixel Crushers forum, or email tony (at) pixelcrushers.com, whatever you prefer.
     
    Weblox likes this.
  24. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    223
    Questions fort TonyLi,

    Dialogue System :

    Hi TonyLi,

    I want to try out your trial version of the Dialogue System from your web site download......

    Do I need to buy and install the asset S-Inventory for it to work (DS) in my project?

    Will I need to Uninstall my current version of your RFPSP Save System or Dialogue System overwrite/update/convert and work without doing so...

    Thanks

    Peter
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    Hi Peter,
    Only if you want to use the S-Inventory integration. If you don't plan to use S-Inventory, then you only need to import the Dialogue System, and then import the Dialogue System/Third Party Support/Realistic FPS Prefab Support unitypackage.

    You can have both in the project. They won't conflict with each other.
     
  26. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    223

    Hi TonyLi,

    Thanks for that.

    I have a couple of questions if you can help please?

    When choosing/adding/amending/updating existing project non player NPC's via DS where should their prefabs be selected from? i.e. the NPC Folder or the game level project window? and can the the same prefab therefore be different in every level - that is by duplicating and changing their properties so I can have numerous same characters with different behaviours or animations in each level without applying to the "Global" Prefab and thus having to create a different prefab for every same character behaviour set as I can do with RFPSP. Hope that makes sense?

    When adding non player NPC's do I have to add every instance of a character to the Database as a new entry Character? i.e. can we see/build a list of many characters that we can edit individually or is it a case of stuck with a single version of a character prefab. For some reason I could not find a way to save an NPC entry and then add another different one as when I open add NPC's I get the one and only entry made and if I add another NPC' it overwrites the first and I seem to be able to add only one? Clearly I must be missing something. This is relative to the above question of course.

    I have done a quick test and am now making a copy of the real full project to date and will try it in that whilst keeping my master project files untouched to be on the safe side :)

    Looks like a nice piece of kit but think it may take me months to go through everything and transfer all my current work to it as the game is already done to a stage of a lot of interactivity and dynamics to swap out is and is enormous. I have around 15 levels completed in a basic form and more levels half constructed/completed to date and about double that to get through yet.

    Thanks

    Peter
     
  27. VE_GAME

    VE_GAME

    Joined:
    Mar 13, 2014
    Posts:
    39
    How to make ?
    How to make auto-shooting
    when aiming at a target, a shot fired

    Sorry for bad english it's not my native language
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    Hi Peter,

    That's a good idea to make a "branch" for the the version of your project that incorporates the Dialogue System.

    In your dialogue database, each actor will be a speaker in a conversation. They don't necessarily have to correspond to GameObjects in the scene, but they usually do. Mostly you define actors in your database so you can specify who's speaking any given line in a conversation.
     
  29. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    367
    Back on page 89, https://forum.unity.com/threads/realistic-fps-prefab-released.176985/page-89
    TonyLi wrote a script called ColorCrosshairByTarget.cs (It's near the bottom of the page). You can use this as a starting point but you just won't change color, you'd shoot.
     
    VE_GAME and TonyLi like this.
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    ^ To shoot, cache a reference to PlayerWeapons. For example:
    Code (csharp):
    1. playerWeapons = FindObjectOfType<PlayerWeapons>();
    Then, when you want to shoot, send the message "Fire" to its current weapon:
    Code (csharp):
    1. playerWeapons.CurrentWeaponBehaviorComponent.SendMessage("Fire");
     
    VE_GAME likes this.
  31. VE_GAME

    VE_GAME

    Joined:
    Mar 13, 2014
    Posts:
    39
    Thank you so much :)
    Changing color is what I just need.
    I suffered a few days to do this.
    And here there is a ready script
     
    jnbbender likes this.
  32. VE_GAME

    VE_GAME

    Joined:
    Mar 13, 2014
    Posts:
    39
    Thank you for the script and timely help.
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    Glad to help!
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    BTW, to add this change, add these lines to the end of the LateUpdate() method:

    Code (csharp):
    1.         if (ai != null && ai.factionNum > 1 && player.PlayerWeaponsComponent.CurrentWeaponBehaviorComponent != null)
    2.         {
    3.             player.PlayerWeaponsComponent.CurrentWeaponBehaviorComponent.SendMessage("Fire");
    4.         }
    So the whole script is:

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. [RequireComponent(typeof(FPSPlayer))]
    4. public class ColorCrosshairByTarget : MonoBehaviour
    5. {
    6.  
    7.     public Color[] factionColor = new Color[4]
    8.     {
    9.         Color.white,     // Nothing
    10.         Color.green,     // Friend
    11.         Color.red,       // Soldier/alien
    12.         Color.magenta }; // Zombie
    13.  
    14.     public float unarmedCrosshairRange = 50;
    15.  
    16.     public LayerMask unarmedCrosshairMask = (1 << 0) | (1 << 13) | (1 << 18); // Default, NPCs, Liquid Collision
    17.  
    18.     private Transform mainCamTransform;
    19.  
    20.     private FPSPlayer player;
    21.  
    22.     void Awake()
    23.     {
    24.         mainCamTransform = Camera.main.transform;
    25.         player = GetComponent<FPSPlayer>();
    26.     }
    27.  
    28.     private Vector3 lookDirection;
    29.  
    30.     void LateUpdate()
    31.     {
    32.         var shotOrigin = player.transform.position + player.transform.up * 0.8f;
    33.         var playerDist = Vector3.Distance(mainCamTransform.position, shotOrigin);
    34.         var range = (player.WeaponBehaviorComponent != null) ? player.WeaponBehaviorComponent.range : unarmedCrosshairRange;
    35.         var bulletMask = (player.WeaponBehaviorComponent != null) ? player.WeaponBehaviorComponent.bulletMask : unarmedCrosshairMask;
    36.         AI ai = null;
    37.         RaycastHit hit;
    38.         if (Physics.Raycast(mainCamTransform.position + (mainCamTransform.forward * playerDist), mainCamTransform.forward, out hit, range, bulletMask))
    39.         {
    40.             ai = hit.transform.GetComponentInChildren<AI>() ?? hit.transform.GetComponentInParent<AI>();
    41.         }
    42.         player.crosshairUiImage.color = factionColor[(ai != null) ? ai.factionNum : 0];
    43.         if (ai != null && ai.factionNum > 1 && player.PlayerWeaponsComponent.CurrentWeaponBehaviorComponent != null)
    44.         {
    45.             player.PlayerWeaponsComponent.CurrentWeaponBehaviorComponent.SendMessage("Fire");
    46.         }
    47.     }
    48. }
     
    Mark_01 and VE_GAME like this.
  35. Fortitude3D

    Fortitude3D

    Joined:
    Sep 7, 2017
    Posts:
    155
    Cute Fps project, looks cute as haha
     
  36. VE_GAME

    VE_GAME

    Joined:
    Mar 13, 2014
    Posts:
    39
    Very good

    Thanks!
     
  37. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    254
    Hey all. I have an odd error that i was trying to fix.

    in short. has/does anyone have the main RFPS menu working with keyboard input? I am trying to use the menu in a mobile/android VR game and it looks like it only fires off with a mouse click. (and of course there are no mice in mobile) so i am wondering if I miss set a check box or something some where and am not sure I have ever seen the menu wirk with any keyboard buttons to choose and select the menu options.

    Also not, i am using rewired for input management and have tried a whole slew of things to get it to work to no avail.

    Thanks in advance.
     
  38. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    198
    Hey, Jons 190 ... Try to contact the Rewired developer, i'm sure they will be glad to help you out, as a customer, for your little input problem here, just tell them everything as it is :)
     
  39. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    164
    Hey guys, i need help with something mainly to do with AI, is there a way to get the other enemies to notice other enemies death and then try to search for the player :/. it just sucks that they are soo blind and inactive XD... I'm gonna stick with zombies atm. But yeah if anyone knows a fix let me know please :p.
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    Save System for Realistic FPS Prefab 20% for Plus/Pro Users

    If you subscribe to Unity Plus or Unity Pro, you can pick up the Save System for Realistic FPS Prefab for 20% off. If not, it's inexpensive anyway -- just $10.


    RFPS's main menu uses the legacy GUI system, which doesn't natively support keyboard input.

    Your best solution is probably to create a Unity UI world space canvas or screen space - camera canvas. Add UI buttons to it. Then make a copy of the MainMenu.cs script that exposes each legacy GUI button's functionality as a separate public method. Add this script to the canvas, and hook up the UI buttons' OnClick() events to the public methods.

    I think it will require a little custom scripting. Fortunately the CharacterDamage script has an OnDie() event that you can hook into to make it easier. Point this event to a script that tells nearby allies to attack the player. Or consider using a third party AI asset such as Tactical Shooter AI or Emerald AI.
     
  41. jandd661

    jandd661

    Joined:
    Jun 25, 2017
    Posts:
    18
    Hello all. I am very interested in this asset. Can anyone tell me how well it works with UMA? I am much better at code than animation, modeling so I'm hoping it is possible to use UMA with this asset.
     
  42. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    Here ya go.. it works and is documented.



    M
     
    TonyLi and Mark_01 like this.
  43. jandd661

    jandd661

    Joined:
    Jun 25, 2017
    Posts:
    18
    Great! Thank you.
     
  44. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    164
    Oh my god, i am starting to hate unity XD... Need help with this error:

    Shader error in 'FX/SimpleWater4': failed to open source file: 'WaterInclude.cginc' at line 43 (on d3d9)

    I haven't even touched the water system and this is what happens along with the "clustering | 1 job..." for hours XD
     
  45. VE_GAME

    VE_GAME

    Joined:
    Mar 13, 2014
    Posts:
    39
    Tell me please how to activate a weapon from another script ?
    Example: M1911 == true
    I have been suffering for a long time (
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    Two parts:

    1. Give the weapon to the player: Find the M1911's WeaponBehavior script. Set its haveWeapon bool to true.

    2. Activate the weapon: You need the index of the weapon in the PlayerWeapons script's weaponOrder array. (By default, M1911's index is 2). Then run:

    Code (csharp):
    1. var playerWeapons = FindObjectOfType<PlayersWeapons>();
    2. var weaponIndex = 2; // M1911
    3. StartCoroutine(playerWeapons.SelectWeapon(weaponIndex));
     
  47. jandd661

    jandd661

    Joined:
    Jun 25, 2017
    Posts:
    18
    I thought I seen this question somewhere but I can't seem to locate it at the moment. I'm trying to find where the fog is applied to the main camera. On the Main Camera there is a script Global Fog but, enabling, disabling or changing parameters only seems to be additive to what is there. I can't seem to find anything in the UI area and my global fog is not enabled in the lighting tab. Does anyone have any insight as to what else I can check. Thanks for your help.
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    There are also effects on the Weapon Camera, which is a child of the Main Camera. And there's also the scene fog (Window > Lighting > Scene > Fog).
     
  49. jandd661

    jandd661

    Joined:
    Jun 25, 2017
    Posts:
    18
    Your a hero Tony. Thanks. It was the weapon camera bloom. I feel a bit dumb now that I missed it. Thanks for your help!
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,723
    Glad to help!
     
    Mark_01 likes this.
unityunity