Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Third person cover controller

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

  1. playerinteractive

    playerinteractive

    Joined:
    Jul 28, 2018
    Posts:
    3
    hy sir i want to remove camera shaking when firing from guns please help me ??
     
  2. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    116
    go to gun script than Adjust shake parameters of recoil
     
    playerinteractive likes this.
  3. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    116
    you should add animations to Death layer in animators. now add parameter int deathType. when player die then get animator change deathType value. i.e deathType=0 for enemy, deathType=1 for traps etc.
     
  4. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    116
    you should change in ThirdPersonInput.cs Class like that
    Code (CSharp):
    1.  public class ThirdPersonInput : MonoBehaviour
    2.     {
    3.    public bool isPause=false; // add this variable
    4. private void Update()
    5.         {
    6.             if (Disabler != null && Disabler.activeSelf && !isPause) // change here
    7.                 return;
    8.  
    9.             UpdateCamera();
    10.             UpdateTarget();
    11.             UpdateCustomActions();
    12.             UpdateMovement();
    13.             UpdateWeapons();
    14.             UpdateReload();
    15.             UpdateRolling();
    16.             UpdateAttack();
    17.             UpdateGrenade();
    18.             UpdateCrouching();
    19.             UpdateClimbing();
    20.             UpdateCover();
    21.             UpdateJumping();
    22.  
    23.             _controller.ManualUpdate();
    24.         }
    25. }
    now when you open menu you just get ThirdPersonInput.cs class and make isPause=true.and when menu close make it True.isPause=false
    I hope its Help you
     
  5. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,415
    @EduardasFunka Are you ever going to have a character setup wizard instead of having to tediously setup from an existing character?
     
  6. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    116
    yes same problem
     
  7. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    224
    Woot! Thx
    I needed to change this
    Code (CSharp):
    1. (Disabler != null && Disabler.activeSelf && !isPause) // change here
    2.                 return;
    To this instead
    Code (CSharp):
    1. (Disabler != null && Disabler.activeSelf || isPause == true) // change here
    2.                 return;
    And it worked
     
    Last edited: Dec 7, 2018
  8. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    449
    its in plans for quality of life features. But it's not a high priority now. We thought you guys will customize it for your game.
     
  9. CupitorImpossibilium

    CupitorImpossibilium

    Joined:
    Jul 23, 2012
    Posts:
    287
    maybe you should do a poll about this? I think more people are interested than you think ;) myself for that matter i'm very interested
     
  10. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    449
    I did that on my patreon page.
     
  11. CupitorImpossibilium

    CupitorImpossibilium

    Joined:
    Jul 23, 2012
    Posts:
    287
    oopppsss... I missed that :oops: Voted for "Quality of life (speedup)"
     
  12. StaticWave

    StaticWave

    Joined:
    Aug 21, 2016
    Posts:
    16
    I started a character setup wizard yesterday. Here is the start of it. Feedback and help welcome: https://github.com/kristiandelay/Third-Person-Cover-Shooter-Template-Character-Tool



    I plan on adding attaching of weapons next, they will be populated from a user generated prefab weapon list.

    once that is finished, i will add an ai checkbox to automate adding the ai scripts.

    I havent gone to bed yet, i wrote this over an all nighter so sorry for lack of better error handling.

    Suggestions comments welcome.

    Cheers enjoy!
     
  13. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    224
    Hah very nice.
     
    StaticWave likes this.
  14. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    257
    Don't like the pink. JK
     
    StaticWave likes this.
  15. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    257
    I was hoping to have a little help on this script and maybe we can all use it.
    The camera clips through the players head when it gets too close and therefore does not look too appealing. The attached script is supposed to create a Lerped fade based on the camera distance to the player, instead the player just quickly fades out. The video shows what's happening and the script which shows a feeble attempt at the Lerp. Sorry about the jitter, that's the recording software.



    In the script
    "FadeAt" represents the distance at which the camera is supposed to begin its fade.
    "MinOpacity" represents the minimum Alpha value that will be Lerped to (i.e. 0 == invisible)

    Note: This script works good with the Standard shaders just not the Legacy ones.

    Any ideas, help would be great.
     

    Attached Files:

    f1chris and StaticWave like this.
  16. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    224
    I think what's happening here is with your alpha unless you present it as a fraction it jumps from 0 to 1 so if you want it tonlerp you need to have it hold a value like this col.a = .1f/255f then similar on your max.
    I don't know why Unity does it this way but I had to do that as a work around for my night vision script. I'm on my phone so I can't come up with a working example but give that a shot
     
  17. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    257
    Still working it. Just making things worse though; this is more of a CPU hog than anything. There should be a shader solution I am just no good with 'em
     
  18. StaticWave

    StaticWave

    Joined:
    Aug 21, 2016
    Posts:
    16
    Bahah i knew someone was gonna say something about the pink
     
    CupitorImpossibilium likes this.
  19. camsha

    camsha

    Joined:
    Nov 18, 2013
    Posts:
    8
    Hi, guys. I recently bought this asset and I am enjoying it so far. I am using a mobile character and controls in a nearly empty scene. When I drop a zombie enemy prefab in, he seems to behave normally until he sees me. At this time he closes to within about 4 meters and then circles me forever. His FighterBrain sets the state to assault and on the next frame it goes to circle. When circle finishes, this repeats - back to assault for one frame and then circle. In the Prototype Scene that comes with the asset, the zombies function normally. I tried using the cowboy from that scene with a zombie from that scene in a new scene, with mobile controls, and I still just get circling. Any ideas? Thanks.
     
  20. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    220
    did you rebake the navmesh ? if that won't work try the other way around
    try to import the mobile player and controller to the zombie example scene
    1-open the zombie example , delete the player prefab and all the unwanted stuff
    2- drag and drop the mobile example scene in the Hierarchy menu
    3-grab the mobile controlls and UI and the player and drop them in the zombie example scene

    it could be anything from player tag , to actor side script ... ect
     
    camsha likes this.
  21. camsha

    camsha

    Joined:
    Nov 18, 2013
    Posts:
    8
    In my research through this forum, I saw this:
    "We are not using Navmesh Agents as those have their own movement controls and physics."
    And somehow I read that as "We are not using navmeshes..." so I didn't go down that path (pun not intended).
    Anyway, yes, I just needed a navmesh baked. Thanks for the quick reply. I guess I am used to navmesh agents that will warn you if there is no navmesh and they won't walk around at all. These guys seemed to work fine until they got close to my character.
    Thanks again.
     
    Rahd likes this.
  22. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    103
    Hey, I would like to know if there is a camera shake component on projectile impacts and explosions. I didnt see anything of the sort in the documentation. Thanks
     
  23. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    224
    Easy peasy actually. Let me pull up my way right fast:
    Most of thats already built into the camera script , you just need to tell it what to do.

    On what ever your using add:
    Using CoverShooter;

    then add these variables to your script:
    [Tooltip("Camera shake duration when exploded.")]
    public float ShakeDuration = 0.5f;
    [Tooltip("Camera shake intensity when close to the camera.")]
    public float ShakeIntensity = 100;

    And in your collision method:
    ThirdPersonCamera.Shake(transform.position, ShakeIntensity, ShakeDuration);

    Here is how I call my shake with explosions:
    Code (CSharp):
    1. void ExplosionWork(Vector3 explosionPoint)
    2.         {
    3.          
    4.             hitColliders = Physics.OverlapSphere(explosionPoint, blastRadius, explosionLayers);
    5.              
    6.                 foreach (Collider hitCol in hitColliders)
    7.                 {
    8.                     if (hitCol.GetComponent<Rigidbody>()!= null)
    9.                     {
    10.                         hitCol.GetComponent<Rigidbody>().isKinematic = false;
    11.                         hitCol.GetComponent<Rigidbody>().AddExplosionForce(explosionPower,explosionPoint,blastRadius,UpwardForce,ForceMode.Impulse);
    12.                         hitCol.GetComponent<CharacterHealth>().Deal(ExplodyDMG);
    13.                         ThirdPersonCamera.Shake(transform.position, ShakeIntensity, ShakeDuration);
    14.                     }
    15.                 }
    16.         }
    ** hint hint its the last line.
     
    Rahd likes this.
  24. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    103

    Thanks a bunch!. Just to be clear, I put this script on the projectile collider or the prefab itself?
     
  25. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    224
    In my case I put it on my explosion prefab.sonyoull want it on your collider but you'll need to alter the code to meet your requirements. Mine was case specific
     
  26. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    169
    Is there a way to set spawn points for the player? I'd like to set up checkpoints where the player would respawn if killed rather than starting from the very beginning .

    -rich
     
  27. myselfshj

    myselfshj

    Joined:
    Mar 30, 2012
    Posts:
    29
    Hello everyone, I've purchased this asset.
    I am reading and learning the scripts. IK part is difficult to understand.
    I'm confused about aimintensity using in IK.UpdateAim().
    Can anyone tell me what aimintensity or handintensity means? What's the purpose of using these 'intensity' ?
     
  28. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    148
    Hello sir.

    How can I adjust the crosshair while character moving?



    As you can see in the video the crosshair scale up too much. Where can I adjust it?
     
  29. StaticWave

    StaticWave

    Joined:
    Aug 21, 2016
    Posts:
    16
    Finished up Weapon Scriptables, AI Scriptables and Weapon Inventory Scriptables, all with respective prefab generators.

    Next steps will be to clean up, comment and add better error handling. W4UagLvOEK.png

    Cheers
     
    Last edited: Dec 11, 2018
    JuanFLZ, satchell and Paul-Swanson like this.
  30. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    257
    Look at the posting above with the weapon setup that @StaticWave is putting together. On the far right is the Custom Crosshair settings. Here you just adjust "High Angle", "Scale" etc. not sure which just play around.
     
  31. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    169
    Hello!

    Is there any way to modify the cover script so that if the play approaches a wall (low or high), he will automatically climb/vault the wall without going into a cover pose first? I will have some levels with no enemies so I don't need the player to take cover.

    Thanks,
    rich
     
  32. StaticWave

    StaticWave

    Joined:
    Aug 21, 2016
    Posts:
    16
    EduardasFunka,before i release the rest of the tool i need to ask if its ok. I have created scritpable objects based on some of the core scripts. I copied and pasted just the public variables from some of the core classes. I did this so the variables matched and caused as little confused as possible. The tools code does not expo any functionality just variable names. As soon as i can get a go ahead ill push out the finished tool to git and make a tutorial.

    Cheers!
     
    Neviah and SteveB like this.
  33. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    58
    Maybe you can use this project to add the jump for the low covers.
    https://assetstore.unity.com/packages/templates/tutorials/mecanim-gdc2013-sample-project-9896
     
  34. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    169
    Btw that looks awesome!
    did you do the artwork yourself?

    -rich
     
    Pollawat likes this.
  35. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    449
    Yes do it.
     
  36. StaticWave

    StaticWave

    Joined:
    Aug 21, 2016
    Posts:
    16
    OK here it is!!
    https://github.com/kristiandelay/Third-Person-Cover-Shooter-Template-Character-Tool

    I've converted all the default values to use scriptable objects, this allowed me to get around the need to create the resources folder and move folders around in the base CoverShooter project.

    I have already set up basic default scriptable objects to help get started using the tool right away. Give the scriptables folder a look and create or configure your own scriptable objects.

    Here are the new generator windows


    And here are the new scriptable object options



    The quick general use steps are to use the character generator to set up the basic locamotion controls.
    Once the character is set up, use the weapon prefab generator to create all your new weapon prefabs.
    After you save your newly created weapon prefabs you can use the weapon inventory to attach the new prefabs to the characters left and right hands.
    At this point you still need to position the weapon models. I know, I know... why can't the weapons be magically positioned for you?!

    After you have configured the weapon inventory scriptable object you can now use the AI generator on the newly created character prefab, the generator will disable the input and let the AI take over the character. =)

    That is the quick and dirty, written and video tutorials to come!

    if you have questions before i get to the readme and tutorial video ask away.

    Cheers!
     
    Last edited: Dec 12, 2018
  37. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    58
    Appreciate the work, will definitely save time. Thanks!
     
  38. camsha

    camsha

    Joined:
    Nov 18, 2013
    Posts:
    8
    Impressive! Thank you.
     
    StaticWave and SteveB like this.
  39. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    449
    Amazing stuff. Maybe we need to release community patch with stuff you guys sharing. Not sure if it not against asset store rules. You could push to GitHub your stuff and I will push it to store.
     
  40. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    116
    look your weapon script and also look you camera
     
  41. StaticWave

    StaticWave

    Joined:
    Aug 21, 2016
    Posts:
    16
    You can use the code that is in the github link above EduardsFunka. Im not sure what github project you want me to push it too. If you post a link i can open a pull request or something.

    Cheers
     
  42. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    148
    Thank you, sir, and yes. for all of the environment parts.
     
  43. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    148
    Thank you, sir, the problem is not that part sir.

    When I modifying the low, high, or scaling it also affect the shooting crosshair too. I just simply need to scale down just while moving not shooting.

    - TPS
    - Gun
    - BaseGun
    - other scripts

    I get in and hit "Ctrl+F" and search for them but I can't find it. I think I'm looking in the wrong place somehow.
     
    Last edited: Dec 13, 2018
    StaticWave likes this.
  44. CupitorImpossibilium

    CupitorImpossibilium

    Joined:
    Jul 23, 2012
    Posts:
    287
    StaticWave likes this.
  45. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    224
    Can I ask why you have 2 scripts to control mouse lock?
    ExitToEscape.cs and the MouseLock.cs script
    The one on the player and the one on the camera...
    I just merged them both with zero issue. so it doesn't seem to impede functionality.
    I noticed when i was trying to disable the mouselock and it kept getting reset in a Update.
     
    Last edited: Dec 14, 2018
  46. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    257
    @EduardasFunka
     
  47. StaticWave

    StaticWave

    Joined:
    Aug 21, 2016
    Posts:
    16
    If you look all it does is call Application.Quit(); when the user pressed escape. I think the intent here is to not use the escape to exit script in production, it seemed to me that it was just for exiting the demo when you run the build outside of the editor.
     
  48. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    257
    You know what would be great! Is a collider/cover setup. I have only been able to do it twice by sheer luck. Funny how on a Cover Shooter platform it's so difficult to set cover. Anyway, a menu to setup Cover would really kill!
     
    Blackghost likes this.
  49. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    239
    Just moved to 2018.3 . The root motion is now required but since when jumping my character stays in the air and landing very slowly. Any fix or tweak for that ? thanks !!!
     
  50. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    220
    and there's a bug on the [Physics.PhysX] RigidBody::setRigidBodyFlag: kinematic bodies
    https://issuetracker.unity3d.com/is...re-not-supported-error-thrown-during-playmode
    Fixed on 2019 Beta
    i would strongly recommend 2017.4
     
    f1chris likes this.