Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Mega Sale Ends DECEMBER 8 - Get Save System for RFPS for $7

    Just posting a quick reminder that the Asset Store's Mega Sale ends DECEMBER 8 at midnight PST. You can get the Save System for RFPS for just $7, and view all the assets on sale here.

    [EDIT: Sorry! I got the date wrong. The Mega Sale is still going on until December 8!]
     
    Last edited: Dec 2, 2017
  2. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Has anyone had any success integrating Node A.I. 3? or is do I not bother and just go ahead with Behavior Designer?
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Correction: The Mega Sale ends December 8 at midnight PST! Sorry for the wrong info in my previous post. I just fixed it.
     
  4. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    Quick confirm that if I have your dialogue system then I don't need the Save system??

    Regards
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Yes, that's correct. The Save System is simpler to set up if you only need saved games and persistence across scene changes. The Dialogue System's RFPS integration requires a few more steps to set up, but of course you get conversations, quests, barks, etc.
     
  6. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    Not sure about Node.AI but I am succesfully using NodeCanvas with RFPS o far although I have had to do changes to the AI script in a few places for the movement to work.

    M
     
    Last edited: Dec 2, 2017
  7. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    From first impressions it appears to be a little simpler to work with than Behavior Designer for someone who doesn't know Behavior Trees. ;) Does anyone have any experience with Behavior Designer?
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    I'm going to be offline most of the weekend, but I'll help if I can. Behavior trees are really useful as a general AI technique, although they do have a learning curve. I'm not sure if Behavior Designer's RFPS integration needs to be updated for RFPS 1.44. It does come with a simple starter behavior tree, though. You can combine the actions from that with the more sophisticated AI from some of the non-RFPS example scenes to make a pretty smart AI.

    If you're looking for something like Node.AI that you can just drop in, consider Tactical Shooter AI, which is currently on sale 50% off. It has RFPS 1.23 integration, which shouldn't take too much effort to update to RFPS 1.4x.
     
  9. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Thanks much for the input. Guess I just have to figure out which way I want to go.
     
  10. halo_of_the_sun

    halo_of_the_sun

    Joined:
    Sep 17, 2017
    Posts:
    64
    The arrow doesn't have a Player Tag, I'm going to play around with it and let you guys know what I find.

    On another note: does anyone have any resources on how to add a Knock-Back / Strafe / or Death animation to the NPCs? I've pulled off multiple attacks and the like but those 3 are a bit tricky (Tried turning off ragdoll and adding a Prefab with only a Death Animation as the Death Replacement, but the Zombie still ragdolls)

    p.s. love how active this community is, I always keep the tab open to learn more things!
     
  11. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    Greetings all :)

    I'm trying to add a little more AI to my game and have an external program which I am using to do it. I wanted to preserve all the existing AI options so am using the standard AI as delivered and calling it from the external program.

    I'm trying to set up a wander script and decided to use the GoToPosition in the AI script from a NodeCanvas event.

    so the code I have is as follows....

    Code (CSharp):
    1.         void DoWander(){
    2.             var myAI = agent.GetComponent<AI>();
    3.             var min = minWanderDistance.value;
    4.             var max = maxWanderDistance.value;
    5.             min = Mathf.Clamp(min, 0.01f, max);
    6.             max = Mathf.Clamp(max, min, max);
    7.             var wanderPos = agent.transform.position;
    8.             while ( (wanderPos - agent.transform.position).sqrMagnitude < min ){
    9.             wanderPos = (Random.insideUnitSphere * max) + agent.transform.position;
    10.                 if (!myAI.huntPlayer && !myAI.heardPlayer && !myAI.pursueTarget && !myAI.heardTarget && !walking)
    11.                 {
    12.                     myAI.GoToPosition(wanderPos, run);
    13.                     walking = true;
    14.                 }
    15.             }
    16.  
    17.             if ( !agent.SetDestination(wanderPos) ){
    18.                    DoWander();
    19.              }
    20.         }
    This gets me a random position near my AI on the navmesh and then calls GoToPosition with the position and whether to run or walk and then holds onto things until the point is reached and breaks out if it gets hurt or you get to close to it.

    The issue is that 9 times out of 10, it's fine.. that 1 time however, the GoToPosition is called and the NPC starts limping along like it has a wooden leg and dragging one leg behind it, sometimes in a circle and never gets to quit the routine. Oddly enough, if I run upto the NPC or shoot it.. it correctly breaks out of the routine and chases and shoots back.

    I'm sure something is getting out of sequence but have no idea what and get no error messages or console warnings.

    Has anyone got any ideas?

    Regards

    M
     
    Last edited: Dec 2, 2017
  12. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Curious - My NavMesh definitely has "jump" points but the NPC's won't take them. Could it be an issue with the script or not at all?
     
  13. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi,

    I know there is a post here somewhere with instructions and a script relating to setting up an enemy "Turret" that I believe was posted by TonyLi though I may be incorrect there?

    Anyone have a link to the page containing or I will have to go through all the pages with a fine tooth comb?

    Thanks

    Peter
     
  14. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    Page 49
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    This is the post. No guarantees if it works with the latest version of RFPS. It also uses the Dialogue System's RFPS integration to disable the RFPS player while in the turret. If you're not using the Dialogue System, you could probably modify it to use RFPS's MovePlayerAndCamera script to temporarily disable RFPS's control of the player and camera.
     
  16. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi TonyLi,

    Thanks very much for that. I will have a look at that though I have found a Turret that targets the "Player" I am trying to set up now which is what I was looking for at this stage. Of course I would also like an option to have Turrets that the Player can control too so he can shoot at enemies :)

    I find your info very interesting ( you could probably modify it to use RFPS's MovePlayerAndCamera script to temporarily disable RFPS's control of the player and camera ) as I may be able to consider such for integrating a drive able vehicle for the Player which I mentioned recently (and other scenarios possibly) where again although I have a wotrking "woraround" to do that its not an ideal solution as the only way I could find to get the Player to get in a car (faked) and drive it around was to use the Player Main Camera and Input control which poses some problems though as said will work in restricted scenarios but is not really the way to do it. Currently it disables the Player camera permanently and I cant recover it at the moment and I can work around that too. There are other issues too such as the car needs to take the place of the Player completely in effect so that it takes damage which registers to the player (done) deal out damage, and being able to shoot from, get in and out of as many times as wanted and so on....

    Complicated, and without an integrated RFPSP solution I guess workarounds are the only option :) At least I have a basic working - get inable/driveable vehicle and I will see if i can update it further as and when needed....

    Turret now :)

    Thanks again

    Peter
     
  17. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    Peter.. don't know if it will help, but I have fully implemented turrets in my game which can be both enemy and friendly. (the package allows you to take control of the turret as a player, but I haven't tried to do any of that.. I just use them as automatic units), and yes the turrets have a health.

    I used this asset.. https://assetstore.unity.com/packages/tools/ai/smoothturret-39422

    and this one for my actual turrets.. https://assetstore.unity.com/packages/3d/props/weapons/realistic-turrets-2-60808

    Heres a pic (not a very good one I'm afraid) of the turret firing at a robot invading the base..

    turret.jpg

    If it helps, I could help with the steps that I took to make this work.

    I'm using Unity 2017.1.2f1 (64bit) on Win10 on DX11.

    M
     
    TonyLi and Apposl like this.
  18. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm experiencing an issue with the camera controller's clipping. In general, it works as expected. When an obstruction gets in the way then the camera moves in closer to the player as it should. However, I started noticing that the camera would randomly move in closer to the character when running around my terrain. So, I put a debug message into the script to see what it thought it was colliding with and it turns out to be the Terrain. But the camera is well above the terrain and the area is wide open. But somehow the hit detection is finding the terrain to be between the camera and player even though it isn't. I will try to debug further when I get a chance, but I wanted to bring up the issue here in case someone else has seen this and knows of a solution.
     
  19. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Is that in First or third person view or both? In the latest releases the camera clipping defaults are a bit of an issue especially third person view where the camera tends to clip through walls and sometimes through terrain and through player too. Not sure if one could improve this with enough tweaking or perhaps make it worse :) I tried a few adjustments at one time and did overall in balance tend to make it worse I thought or no better at least. There are so many things one could tweak, adjust and fine tune a great I guess, everything from player colliders, camera positions and so on. The system works but I have found it also to be a bit off out of the box too myself.

    Cameras and their collision have always been a difficult thing to get perfection in with many game engines. It does not seem to be an easy thing to achieve.

    :)
     
  20. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Third person only

    OK, so I'm not the only one.

    Thanks for the information. I might convert camera control to use Ootii's Camera Controller, which doesn't have these sorts of issues. But it might turn out to be a difficult task.
     
  21. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    I looked at using ootii controller since I think it's excellent.

    Came away with the fact that you are pretty much going to have to rewrite all the UI and the FPS player script which is movement, damage, firing, sounds and a few other bits as well. It also handles all the routines for health, food, thirst, some bullet mechanics and reticle change.. which also has the routines for useable objects in :)

    I decided that would be pretty much like starting from scratch and building my own :)

    M
     
  22. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Ugh! That's poor design then. The camera controller should just...well...um....control the camera? lol. Oh well. Maybe I can find a fix for the bad clipping myself.

    [EDIT]
    Hmmm. The CameraControl script doesn't seem to do as much as you are suggesting. I would definitely have to deal with the first person mode separately though. I think it's doable by separating out the third person part from CameraControl and letting Ootii handle that and then switch back to CameraControl for first person. But I think I'll try to fix the clipping first before doing more work than necessary.
     
    Last edited: Dec 8, 2017
  23. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    If I remember I think I tried adjusting the camera when I wanted to move the player weapon position forward or backwards so I could see more or less of it - The Sniper weapon for example I feel displays too much of the player arms forward of the camera in view but changing anything like that means one may have to adjust other things as the position of one can impact on other things like the result on clipping of weapon or camera....I did not seem to achieve any improvement and put it off for another time.

    In third person I find that the camera can clip world objects or the Player himself when the player for example moves around indoors in corridors, near corners, backs into a corner or walks down stairs or even sometimes outdoors in flat areas one can see Player/Camera clip - e.g the camera enters the Player model mesh.

    I understand of course that player/camera relative positions must have some flexibility so as to accommodate many scenarios and both must occupy space - just not each others or that of other Visible objects unless of course its something that it is intended that both or either should pass through :)

    There are a lot of settings one can play about with and with enough patience perhaps any issues could be fixed or improved. I just have not set aside a week or whatever to find out.

    I have enough other problems to contend with at the moment trying to do other things which I am stuck on achieving.

    I still have other NPCs dis-appear when the player collides with them, cant get my car or turrets to work so the camera clip is just another addition to find a solution for :)
     
  24. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    moria15,

    Thanks for that and to everyone else who have kindly posted helpful replies to all my recent questions.

    Much appreciated.

    Peter
     
  25. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    Have you got a rigidbody on the NPC's? I was using a few characters from Morph3d as NPC's and without a rigidbody, they would vanish if I bumped into them. Set as both use Gravity AND Is Kinematic with collision detection set to Discrete and give them a mass of about 10 - 15.

    M
     
  26. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm mainly interested in replacing the third person camera control. I think that can be achieved fairly simply by providing a reference to a disabled Ootii controller and have CameraControl enable it when switching to third person and ignoring any third person code within the CameraControl script itself. I'll probably give this a try a little later on and I'll report my results here.
     
  27. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi,

    On my turret which targets and shoots at the Player hits are not registering and I get a console error message :

    Failed to call function ApplyDamage of class FPSPlayer
    Calling function ApplyDamage with 1 parameter but the function requires 3.
    UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)

    Anyone know what the 3 Parameters it says are required are exactly and where can I find them in an RFPSP script file so I can take a look and perhaps understand what exactly I am missing? and possible copy them into the Turret script?

    Thanks again.

    Peter
     
  28. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Code (CSharp):
    1.  public void ApplyDamage ( float damage, Transform attacker = null, bool isMeleeAttack = false )
    In FPSPlayer.cs
     
  29. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    Damn, sorry didn't read.. thought you were after the NPC damage which is a lot more stuffs :)

    Ignore me :)

    M
     
  30. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I should add that I'm using version 1.43.
     
  31. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Thanks for the replies.

    I have the turret recording hits to the player and reducing the player health OK now which is what I wanted to achieve for the moment. I still get the console error (non Critical so still works) about the 3 parameters but thanks to your help. I guess I can look in the FPS Player.cs for what I need to fix the error message hopefully anyway.....

    I will surely be able to extend the damage to include other objects and other NPC's now I know what code to use though in the case of Allies including them would likely mean they would die very quickly as obviously unlike the player who can avoid the hits an Ally is too stupid to do so out of the box so they would need to be managed by the player to hold position until he destroys the turrets which I have also added to be activated or not where appropriate :)

    At least its also good for Enemies you need to be killed off.

    Thanks again.

    Peter
     
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I just noticed something very odd. When the AI soliders are shooting, their weapons are not properly aligned in their hands and the direction that the bullets are firing from doesn't even match that alignment. It's a miracle they can hit the player at all. I'm hoping I just messed something up in my project, but I re-imported the soldiers and their controllers and it still happens. I will try shortly in a fresh project to verify, but this seems to be a genuine bug.

    upload_2017-12-8_7-56-16.png

    [EDIT]
    Well, it seems fine in a fresh project so I have no idea where I messed it up. I'll try copying over the files from the fresh project and see if that helps. Odd, though. I think it had something to do with the fact that I had 2 other assets that also used the free soldier model and somehow they got all mixed up. Maybe removing meta files might help.

    [EDIT 2]
    Yep, it was a mixup with tactical AI Shooter. It was referencing their soldier mesh and somehow that was messing it up.
     
    Last edited: Dec 8, 2017
  33. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    With RFPSP defaults you could adjust the weapon accuracy in the properties panel though I have no idea if you are using Tactical Shooter AI how that works with RFPSP.

    May I ask how do you find Tactical Shooter AI? Is it any good and do you have to re-set up all RFPSP NPC characters afresh to use it? I have a lot of custom Characters and already spent a lot of time converting them over to and setting them up to work with RFPSP.

    :)

    Peter
     
  34. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I actually decided to not use Tactical AI Shooter due to some issues I was having with it. That's why I was going back to the AI provide by RFPS. With TAIS, you have to either use their prefab soldiers already provided or set up your own completely from scratch. You wouldn't use any RFPS stuff. There are some docs on how to make a few script modifications to make them work together. If you can get past the TAIS issues then it's a nice system with lots of possibilities.
     
  35. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    I'll second that
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Mega Sale Ends Today - Save System for RFPS 30% Off

    Just posting a reminder that the Mega Sale ends at midnight PST. If you haven't picked up the Save System for RFPS yet, get it today for just $7.

    Or click the banner below to see everything that's in the Mega Sale:

     
    magique likes this.
  37. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I highly recommend this system. Very nicely done.
     
    TonyLi likes this.
  38. halo_of_the_sun

    halo_of_the_sun

    Joined:
    Sep 17, 2017
    Posts:
    64
    Anyone played with the AmmoText to add a name? As in having MP5 above the ammo amount? Or a Found the MP5 after picking it up?
     
  39. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Actually, just this morning I added code to display the weapon name in a new UI that I purchased. I added a reference to the new text field in the FPSPlayer script and also added code in WeaponBehavior to show the name. So, it's doable, but you have to use custom code.
     
    TonyLi likes this.
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Like @magique said, it requires a bit of custom code. A quick way to get it done would be to edit AmmoText.cs. In Update(), add the current weapon name to uiTextComponent.text. For example, instead of:
    Code (csharp):
    1. uiTextComponent.text = "Ammo : "+ ammoGui2.ToString();
    use this:
    Code (csharp):
    1. var weaponName = FindObjectOfType<PlayerWeapons>().CurrentWeaponBehaviorComponent.name;
    2. uiTextComponent.text = weaponName + " : "+ ammoGui2.ToString();
    This is quick and dirty. It would be much more efficient to cache the value of FindObjectOfType<PlayerWeapons>() once in OnEnable() and use the cached value in Update.

    If you want to use a separate UI Text element instead of modifying the Ammo Text element, you can set its value in PlayerWeapon.cs's SelectWeapon method or the weapon's WeaponBehavior. method.

    Add a script with a PickUpItem() method to your pickup. Show the message in this method.

    (If you're using the Dialogue System for Unity, just add a Dialogue System On Pick Up Item component to the pickup, and tell it to show an alert message.)
     
    llJIMBOBll likes this.
  41. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    @vincent_lade
    Copy and paste AmmoText GO, rename it to WeaponName and delete any text
    Add var to FPSPlayer.cs
    Code (CSharp):
    1. public GameObject weaponNameUI;
    Add to WeaponBeaviour.cs
    Code (CSharp):
    1. public string WeaponName = "";
    2. [HideInInspector]
    3.     public Text WeaponNameText = null;
    Then in the InitializeWeapon () function
    Add to any line
    Code (CSharp):
    1. WeaponNameText = FPSPlayerComponent.weaponNameUI.GetComponent<Text>();
    2.         WeaponNameText.text = WeaponName;
    On each weapon set the name to how you like
     
    TonyLi likes this.
  42. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    oops posted same time :p
     
  43. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Thanks for that. Thought about as much....

    I would like to update my AI at some time but think it would be like sticking a pin in a Donkey as to guessing what asset might actually integrate without re-inventing my game altogether and taking me another few years to add something i don't know would work or I would be happy with anyway....

    I tried integrating ICE but could not even get the ICE AI NPC's to walk over any floor/terrain properly leave alone anything else. I put it away on the shelf as I cant be asked to fight with overly complicated things that I cant figure out whats wrong when it don't work, I like RFPSP controller and most other things about it but its a bit limited out of the box when making a game that requires a lot of features like AI or other object dynamics...but then again so are most other assets....

    A lot of my levels are quite big open world scenes and because of this a game player (I) get somewhat bored walking around forever with nothing much to do except shoot enemies even if they are different so I have had to add stuff like taking a train ride, a ride in a drop ship and now drive vehicle to break the monotony of "Killing" though I am hoping that my player driven car will knock over a few Enemy NPC's along the way too :)

    At the moment I find keeping Unity and RFPSP updated to the latest versions is enough of a headache as I always seem to end up with a lot of stuff to re-do in any case and with a big game that's a lot of work in and of itself.....

    Keeps me from actual and further Scene/level development/production far too much.

    Thanks again

    Peter
     
  44. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    For my current game I decided to keep things simple and use a tried and true formula like Destiny. In that game you basically just go through and blast wave after wave of enemies, pick up stuff, and occasionally interact with an item. I mean, if it works for a AAA game and people like it then why try to overcomplicate it?
     
  45. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    I have tried to do similar.. it's taken me a number of weeks to get my head around the basics of the RFPS modules and what does who where etc, and how everything is structured.

    Now I have a base, nothing I have integrated is going to get updated.. I have one folder with the version of each product that I am using in and those will be the final versions for this project to save having to upgrade and possibly loose changes. (Even though I think I have marked all the changes and could do a diff compare to find them if needed.)

    I'm pretty happy right now.. I have the base working, and my own NPC's both friendly and enemy. Some using the delivered AI, some using AI driven by NodeCanvas.

    My current workflow tools include.. Unity 2017.1.2f1, Gaia, Enviro, CTS, NodeCanvas, Vegitation Studio, Dialogue System, ENPC Healthbars, Smooth Turrets, ootii Motion Controller on my NPC's (not the delivered ones), HUD Navigation, Quest Machine and then some content packs for odds and sods. (Emerald 2.0) when it comes out will probably be incorporated as well as will an Inventory system that includes a crafting component.

    but as I say, I don't want to waste time upgrading everything evertime a new version comes out, so the version I am using is the one that will stay.

    One major thing outstanding is weapon replcement, but I will crack that at somepoint ( or find someone to do a bit of paid development for me) :)

    M

    P.S. if anyone is interested in a little paid dev and knows the weapon system inside out and could do those mods, please feel free to contact me :)
     
    Last edited: Dec 9, 2017
    magique and 99thmonkey like this.
  46. halo_of_the_sun

    halo_of_the_sun

    Joined:
    Sep 17, 2017
    Posts:
    64
    Thanks TonyLi and llJIMBOBll, I think I have the info I need. One last thing that's holding back a demo is the animations, anyone have any insight into the below?

     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    The AI doesn't strafe, so you'd have to first code that without animation, then add the animation on top.

    For death, the Character Damage script always plays ragdoll if your NPC has more than one capsule collider. These options come to mind:

    1. Remove all but the main capsule collider. Set the OnDie() event to call the ZombieRagdoll's Animator.SetTrigger method, and set a trigger that plays a death animation.

    2. Or assign a Dead Replacement that immediately plays a death animation. Set the Body Stay Time to 0 so it disappears as soon as the dead replacement appears.

    For knock-back, you could edit CharacterDamage.cs and trigger a knock-back animation in the ApplyDamage method. You'd probably want to use the attackDir and/or attackerPos values to decide which knock-back animation to play. If the attack came from the front, knock the NPC backward. But if the attack came from behind, knock the NPC forward.
     
  48. Felicityinc

    Felicityinc

    Joined:
    Nov 24, 2016
    Posts:
    24
    Hey Everyone ,
    Can anyone help me implement automatic shooting with this kit? I mean the player shooting enemy automatically when it comes in the crosshair.(Like Dead Trigger 2)
    Thanks.
     
  49. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Maybe something with Raycast, if hit the layer and is within distance then shoot

    Code (CSharp):
    1. public float Distance = 100f;
    2. public LayerMask Layer;
    3.  
    4. void FixedUpdate()
    5.     {
    6.         Vector3 fwd = transform.TransformDirection(Vector3.forward);
    7.  
    8.         if (Physics.Raycast(transform.position, fwd, Distance, Layer))
    9.            // Do shoot code here
    10.     }
     
  50. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    As an aside here.. has anyone replaced the weapons in RFPS with those from the fpsweapons set? I'm not looking for third person setup at all.. I'm just using direct 1st person with third person disabled.

    IF so, any tips?

    Regards

    M