Search Unity

Third person cover controller

Discussion in 'Assets and Asset Store' started by EduardasFunka, May 23, 2017.

  1. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Hello!

    Quick question: How can I toggle the crouch? Right now, the player only crouches if I hold the default crouch key down.

    Thank you!
     
  2. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    May there's some other way of doing that but I will tell you my workaround and what I did.

    1. Open up ThirdPersonController.cs script.

    2. Create your own boolean (public or private doesn't matter), in this case I created a bool with name of isCrouching.

    1.PNG


    3. On Line 328 in ThirdPersonController.cs
    2.PNG

    4. Change this code with this:

    2b.PNG

    5.After that, In ThirdPersonInput.cs script:

    3.PNG

    Change:
    Input.GetButton("Crouching")

    with

    Input.GetButtonDown("Crouching")


    6. Finally, In ThirdPersonController.cs, comment out Line 724 _wantsToCrouch = false

    4.PNG


    THIS WORKED PERFECTLY FOR ME
     
  3. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    you need to make a function called OnStartMeleeScan' and an other 'OnEndMeleeScan and 'OnEndMelee
    i think 1.61 have those .
    not sure if that error is related to the custom action , i think you need to loop the animation file and bake it like the other default animations that comes with cover shooter


    a simpler one is to open the mobile example , and select the canvas , there is a invisible button in the middle that have a script that will toggle crouch on click
     
    EduardasFunka likes this.
  4. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Hi guys,
    1.6.1 Live
     
    Rahd, redoxoder and angel_m like this.
  5. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    OK will test
     
  6. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Sorry, not yet but it will come soon. I hope you not launching your game this week :)
     
  7. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Not this week yeah. :)
    There are some things that I noticed today. If we set our aim while in cover (Not pressing right mouse button, without pressing aim button, I mean just adjusting our crosshair) and when we go aiming, the cross-hair just shift a little bit up or down. I want it to stay where it is all the time, without aiming and with aiming.
    2nd thing, I don't know if this is fixed or not but while character is in cover mode and we move it to a place where for example is a pillar in the middle of cover, now if I press aim, our gun points in some other weird direction because of collision with the pillar.
     
  8. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170




    This is awesome - thanks. But I'm concerned with changing core scripts. Next time I update, this would probably get overwritten.

    In the Third Person Input component I see "Custom Actions" - Anyone know how to use this? This might solve it.
     
  9. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    I found the button and I see a crouch script attached but not sure how to implement it in my project. How do I override the default "ctrl" button crouch with this?

    thanks,
    rich
     
  10. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170


    Okay I caved in and messed with the code. Your solution works perfectly.
    Thanks!
    rich
     
    Paul-Swanson likes this.
  11. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    @EduardasFunka: After first tests with 1.61 version I have noticed now the changing weapon animation on character is always like all weapons are pistols, I mean the animation arm motion is from the character belt but not from the character back where is supossed to be the rifle holster.
    EDITED: Solved. I have noticed now the weapon Type variable is located in the weapon script (not in CharacterInventory script) and it is reseted to Pistol, so I changed it to Rifle...
     
    Last edited: Oct 2, 2018
  12. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    This might be a silly question but how do you tell what version of this asset I have installed in my project?

    Thanks,
    rich
     
  13. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    319
    When didnyou import it. If you really wanna be sure. You can open the asset in the store and if you see update you can eliminate the most recent version. Does yours currently have melee puches? If yes likely 1.6
     
  14. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    319
    Worked for me too.
    @EduardasFunka
    In the future will you be able to write into the code the ability for the grenades to apply force to object when it goes boom.
    Right now it only does dmg. I made an effort but it didn't seem to work. I tried it on the Grenade in the players hand as well as the actual explosion.
    Attached is my attempt. I saw this on a youtube and changed it to meet my needs.
    Original link is here:
    (Just for the sake of linking back to the source.)

    I was trying to make grenades affect hinge joints. Player makes contact with them fine.
    I wanted the grenades to apply enough force to my hinges joints (doors) that I might be able to blow them out of the frame. Using breaking force.
    But the method below doesn't seem to make contact with the doors...or it does and the doors just wont pick up the force.

    I know your asset doesn't have that built in already so this technically is scope creep, but i think its one of the those nice touches that adds to the flavor of the broth.

    I already made bullets do it by putting a rigid body on them then cranking up mass and turned off gravity. So its doable...I think...


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace GrenadeAddForce
    5. {
    6.     public class GrenadeExplosion : MonoBehaviour
    7.     {
    8.         private Collider[] hitColliders;
    9.         public float blastRadius;
    10.         public float explosionPower;
    11.         public float UpwardForce = 10f;
    12.         public LayerMask explosionLayers;
    13.                    
    14.    
    15.         void OnCollisionEnter(Collision col)
    16.         {
    17.             ExplosionWork(col.contacts[0].point);
    18.         }
    19.    
    20.         void ExplosionWork(Vector3 explosionPoint)
    21.             {
    22.                 hitColliders = Physics.OverlapSphere(explosionPoint, blastRadius, explosionLayers);
    23.            
    24.                 foreach (Collider hitCol in hitColliders)
    25.                 {
    26.                 if (hitCol.GetComponent<Rigidbody>()!= null)
    27.                     {
    28.                         hitCol.GetComponent<Rigidbody>().isKinematic = false;
    29.                         hitCol.GetComponent<Rigidbody>().AddExplosionForce(explosionPower,explosionPoint,blastRadius,UpwardForce,ForceMode.Impulse);
    30.                     }
    31.                 }
    32.             }
    33.        
    34.     }
    35. }
     
    Last edited: Oct 2, 2018
    Rahd likes this.
  15. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    319
    Is anyone else's auto ik setup button missing from 1.61 or is that just me?
     
  16. westryder907

    westryder907

    Joined:
    Dec 28, 2016
    Posts:
    61
    I don't have Auto IK Setup option either.
     
  17. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    319
    OK glad its not just me then.
    I tried poking around inside the asset but I can't find anywhere in the script where it actually make those buttons.
    I was thinking it was maybe commented out, but I simply can't find any reference to it except the comments saying there's a button.
    Was it removed intentionally?

    *edit
    I check 1.5 and compared it to 1.6
    1.5 has all the Auto IK Setup stuff in Editor/CharacterMotor.cs
    but 1.61 is indeed missing it.

    @EduardasFunka will this feature be coming back? Or was this just a mistake?

    *edit, I have been re-educated via a conversation with him. This is now automatic. And I can confirm its working totally fine.
     
    Last edited: Oct 10, 2018
  18. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    i have Problem when player shoot leftside from cover and stop shooting the position of weapon change.
    Screen Shot 2018-10-04 at 12.10.33 AM.png
    shoot rightside from cover and when stop shooting its working fine. (position of Pistol Not Changed)
    Screen Shot 2018-10-04 at 12.37.03 AM.png
     
  19. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    Before i go stick one in, is there a flashlight?
     
  20. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    319
    Yup there's a night scene where he demos it. The guards use them
     
  21. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Hello!

    For some reason my enemy AI drifts thru the ground after being killed rather than just staying on (above) the ground. The Sample AI enemies die and stay on the ground correctly but my character is not behaving the same even though the components and values look identical.

    Thanks,

    rich
     
  22. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    btw when the player equips his gun, a copy of the gun remains in the holster.
     
  23. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    since updating, the NPCs don't damage the player, they shoot at em, hit em. plays an effect, but no damage, the player is able to shoot and kill NPCs, anyone have an idea?
     
  24. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    For the player tho?
     
  25. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    Supposedly the holster bug was fixed in 1.6.1 update
     
  26. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    In CharacterHealth script, there's a boolean Is Taking Damage, make sure it's checked or else your player character won't die.
     
  27. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Same problem. It's something with our configurations because that default Cowboy character, it works perfectly. Problem only occurs with our own character and it's something related to shifting of pistol from right child to left hand child. @EduardasFunka kindly help us fix this problem.
     
  28. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    In some rare cases, we cant mirror weapon. so we made that you can adjust left hand weapon. Just copy weapon to your left hand and adjust it. checkbox prefers swapping in inventory script.
     
  29. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    No, Cowboy character works perfectly, this bug only occurs if we use our own rigged character.
     
  30. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    "Rare cases" with some character bones structures.
     
  31. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    May be not because my character bones structure is same as cowboy and I am sure because I rigged it on mixamo and so does you rigged your character from mixamo.
     
  32. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Yes, I have the character from mixamo that acts similar. Made a tutorial will publish tomorrow.
     
  33. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Please publish all the tutorials of v1.6 because alot of things are changed since v1.5.
     
  34. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    And if you can tell us HOW TO ADD AUTO FIRE then that would be great.
    I just need that line of code which triggers fire when I press left mouse button.
     
  35. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Hey guys! Been peeking at this one for a little bit and it looks pretty nice. Quick question:

    • I'd just as well create my own animations, so I was wondering if there are any technical details to ensure my animations work with the system. (e.g. bone hierarchy/naming, number of bones, frame counts per sequence, etc).
      • What I was able to glean from my perusal of this thread that some people were having issues with the system, but I could gather if that was from attempting to use 3rd party animations or if in some cases they were completely new animations.
    • How extensible is the system, especially with regards to calling new animations within (or outside) the system? Mind you I know how to do this myself from scratch, so I'd assume it would be similar?
      • ...or general gameplay mechanics additions (outside animation)?

    Looking good guys!

    -Steven
     
  36. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    hi I have fix it. make sure you have mixamo rig. open your model in maya or 3dmax delete the rig and export as fbx. now open www.mixamo.com upload your charcter set rig and test animation. and then at last select T pose animation and export with skin.
     
  37. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    Realistic Shell Ejection and MuzzleFlash
     
    Rahd and Paul-Swanson like this.
  38. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170

    nicely done!
     
  39. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Looks great. Quick question, how did you add those shell sounds? And also will you please tell us which asset you are using for muzzle flashes?
     
  40. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    You can replace any animation. There is nothing special about animations.

    I saw some customers replace animations with kubold animations.

    I do not have expierence working with other animation systems to extend functionality so cant comment on that.

    People have problems with one scrip that activates custom animation on seperate layer. Will look in to that.
     
  41. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Nice. I love sounds when shells touch the ground
     
    Dawar likes this.
  42. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Okay so here's another problem I am facing. Why does my aim moves up when I reload pistol or gun?
    Here's what I do:

    1. Equipped pistol
    2. Go to aiming (Zoom with right mouse button)
    3. Fire single shot or multiple, doesn't matter
    4. Without releasing aim, reload the gun and your aim just shifted up.

    Am I the only one who's facing this?
     
  43. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Yes, I can confirm that.
     
  44. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Can you please give us the fix?
     
  45. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    And by the way, when are you publishing new tutorials?
     
  46. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    once I have it will share.
     
  47. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Uploading now to Youtube.
     
  48. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
     
  49. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    How does Layer of Sniper changes to Scope so that while in scope the gun is invisible to the camera?
    I can't find how to do that because I added my own sniper mesh but it's not working, it's still visible when scope se up.

    Anyone?
     
  50. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Does this asset work with Cinemachine?