Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third person cover controller

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

  1. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Use Start() instead of Awake(). That's how I solved it. For some weird reason, awake is not working. If anyone of you solves this issue then please do share with us.
     
  2. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    I have a question related to Grenade. Whenever I through a grenade, it always uses the right hand grenade, why is that so?
    The problem I am facing is when my character is in cover and I throw a grenade, it uses right hand one. And when I throw it, it bounces back from the wall I am in cover with and hence I end up damaging myself. :D
    Anybody solved this?
     
  3. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170


    Unfortunately my programming skills are very poor - how do you implement this asset?
    Do I have to change code?

    thanks,
    rich
     
  4. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170


    Well that just flew right over my head.. Where should I look for this?

    thanks,
    rich
     
  5. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    please there's a box collider on the right hand check it i think thats the one causing this
    all the images have the player model stuck and his right hand is on the platform

    you need to add the awakeme too
    you can keep awake but you need to call updatemanager.additem(this);
    and add override in front each function you change .
    and add the updatemanager in the scene
    check the read me , file it has some tips

    the script is best used when there's like 20 AI on mobile .
     
  6. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Just discovered another issue as I started building this next level in my game. Looks like the Player doesn't like small holes? Even if the hole is larger than the collider it seems. See attached:



    Screen Shot 2019-01-14 at 10.08.13 AM.png Screen Shot 2019-01-14 at 10.07.55 AM.png
     
  7. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170

    I checked that. It's a box collider that's on the pistol but it's a trigger so I don't think that's the problem... I tested with the vanilla cowboy from the demo and he gets hung up also (same collider trigger on the weapon).

    Screen Shot 2019-01-14 at 10.25.42 AM.png Screen Shot 2019-01-14 at 10.11.46 AM.png Screen Shot 2019-01-14 at 10.11.33 AM.png
     
    Last edited: Jan 14, 2019
    Rahd likes this.
  8. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    486
    That makes more sense. Right now all I have is the main character.
     
  9. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    Try putting an object under your scene to give something to hit with a raycast. Like maybe just a huge blackbox
     
  10. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Ok I think I might have finally figured it out and I think it's a Unity issue and not a TPC controller issue. The floor blocks in my game have a box collider on them and visually (as seen in the SCENE window) are in the correct spot. But when I checked the position in the inspector, the Center Y was something weird like -4.4329746e. Even if I clicked Edit Collider, visually it was still correct in the SCENE window.

    Very weird since during game play, the colliders world as expected.

    I changed the Center to 0,0,0 and it seems to be working but have to test a lot more. I'm not sure how/when the Y changed to such a stranger number.


    Screen Shot 2019-01-14 at 10.43.17 AM.png
     
    Paul-Swanson and Rahd like this.
  11. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170



    I spoke too soon - still having trouble :(
     
  12. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    I know I've said this before but I think I found the problem. The COWBOY has a tiny collider under the PISTOL prefab label "LeftHand" (even thought its' on his right hand). If I disable that collider, then the PLAYER doesn't get caught on the platform colliders.

    Not sure what that LeftHand object is used for...

    Screen Shot 2019-01-14 at 7.49.43 PM.png
     
    Rahd likes this.
  13. TotalPixel

    TotalPixel

    Joined:
    May 26, 2012
    Posts:
    19
    Hi all,

    I have updated to unity 2018.3.1f1 and the template works aside from some animation issues. I applied root motion as stated earlier to the models and they now move, however when using the zombies as enemies they walk up to the player fine and then play the het animation, but get stuck at the end of that animation in that pose. Any help appreciated.

    Thanks,
     
    Camelot63RU likes this.
  14. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Hello!

    I just tried doing a build on my project (haven't done one for testing in a while) and I get this error:

    Assets/Third-Person-Cover-Shooter-Template-Character-Tool/Scripts/Utils.cs(18,69): error CS0246: The type or namespace name `SceneView' could not be found. Are you missing an assembly reference?

    However, it runs in the editor.


    Any ideas?
    Thanks,
    rich
     
  15. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170

    This is awesome!
    Thank you!
    -rich
     
    satchell likes this.
  16. Inder8288

    Inder8288

    Joined:
    Sep 11, 2017
    Posts:
    3
    Screenshot (255).png Screenshot (256).png Screenshot (255).png Screenshot (256).png Screenshot (257).png Guys, please help me! I am trying to replace zombie(cover shooter character) with my custom one. I tried copying and paste each component of zombie charater(cover shooter) with mine but it only works in the scene "Third person cover". I created prefab of my custom character and when placed in my new scene, the character stays at one place and dont move and animate at all.
     
  17. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Did you change your character to HUMANOID?
     
  18. Inder8288

    Inder8288

    Joined:
    Sep 11, 2017
    Posts:
    3
    y
    yes i have checked its marked as humanoid and works perfectly fine in "Third person cover" but doesnt work in new scene.
     
  19. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Did you assign Avatar of new character to the animator?
     
    Last edited: Jan 17, 2019
  20. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Anyone know how can I make AI characters to fire on any other object? For example a CCTV camera or a bulb etc.
     
  21. Inder8288

    Inder8288

    Joined:
    Sep 11, 2017
    Posts:
    3
    yes it is also assigned. one thing i have noticed is when i change "body value" to 1 of walking blend tree of "character
    zombie 2 mirror", the zombie starts working. So now, i would like to know how these value is changed?? Sketch.png
     
  22. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170

    Were you ever able to get Cinemachine to work with TPC?

    -rich
     
  23. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Hello!

    Once my player has "found" a weapon, I'd like to disable the ability to change weapons and disable unequiping the weapon. So in other words, once he has the weapon, it doesn't come off.

    Any suggestions?

    thanks,
    rich
     
  24. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    great scott ! does

    Code (CSharp):
    1.             int layermask1 = 1 << 10; //layer 10
    2.             int layermask2 = 1 << 16; //layer 16
    3.             int finalmask = layermask1 | layermask2; // Or, (1 << layer1) | (1 << layer2) //combining both mask
    would work instead of using direct hex code ?

    EDIT : just to mention that i have tested it and it work
     
    Last edited: Jan 20, 2019
  25. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    74
    hello
    any news about next update ???
    submit to the store ???
    bug fixe ?? new features??
    thanks

    ps : a tuto how to use custom action will be nice too.... like how to create stealth kill.
     
    Camelot63RU likes this.
  26. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    Nope not yet never got that far. I was trying to get my minimap to work, so I got stuck on layers. I'm still waiting for @EduardasFunka to answer my question about how make it so my object that are parented to the character don't get their layer overridden when it runs.
    I don't ask much on here tbh, and when I do it is generally about how the asset itself functions, not really how to add new features [except for ladders, and that was answered].I don't have a ton of money so I can't pay for patreon access, I've sent what I'v done to him via email, I'v posted it here and still no answer, I just want a basic explanation of how to prevent the override, I can't figure out how its working. :(

    So TLDR I decided to shelve this until I get answered about those layers eventually. So once I eventually get back to it, I will definitely let you know my findings, I know how to pause inputs currently so that's a start. If you want the method of how I got my Drone controls to work while pauseing the player i can send it to you via PM and you can grab w\e out of it you want. I pulled it from youtube, so there is no issue there with shareing it.
     
    Lay84 and satchell like this.
  27. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    74
    hello
    test the scenes of the asset .
    when i use the fight , animation begin but get blocked like in the picture
    in can't do anything . unity 2018.3.0f2
    any idea ??
    upload_2019-1-20_13-10-55.png
     
  28. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Blocked how? against a collider? Can you capture a bit of video to demo?

    -rich
     
  29. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    To anyone that have added the update manager to improve performance as it was mention before. How have you successfully change the awake function. It return me an error when i add
    Code (CSharp):
    1. OverridableMonoBehaviour.Awake()
    inside my
    Code (CSharp):
    1.  protected override void Awake()
    function mentionning that it cannot inherit from overridablemonobehavior.
     
  30. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    74
    hello
    a vidéo on what append .

    i use unity 2018.3.0f2 root motion activated .

     
    satchell and TotalPixel like this.
  31. TotalPixel

    TotalPixel

    Joined:
    May 26, 2012
    Posts:
    19
    I have same problem
     
  32. jandernunes

    jandernunes

    Joined:
    Nov 18, 2013
    Posts:
    5
    I had the same problem with newer Unity versions. With version 2018.2.8 it works.
     
  33. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    i think 2018.3 breaks the prefabs and animation files settings
    in the video that's a result of the animation not looping or exiting the state
     
    TotalPixel likes this.
  34. TotalPixel

    TotalPixel

    Joined:
    May 26, 2012
    Posts:
    19
    It also seems to stop the melee causing damage to enemies, ive also noticed the throw grenade anim isn't right, then animation plays and then theres a delay before the grenade appears. anyone any ideas on how to fix these?
     
  35. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    hey guys, can anyone tell me where can i find the actual raycast of the gun. The ray sometimes hit the character hitbox and I want to avoid self-firing by adding a layermask to the raycast for the player. Seeking thousand of line im unsure if i have to add the parameter to "hit" or if there is a "raycast" somewhere i can simply add a layermask. Thanks for your help
     
  36. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Found another biggest problem with Third Person Cover Shooter asset.
    Player doesn't go to crouch when melee weapon is equipped. That's really annoying. Anyone got some temporary fix for that? @Rahd @jnbbender @rrabassa @Paul-Swanson
    Anyone?
     
  37. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    simple
    when you crouch unequip the melee , when he stand up he equip
     
  38. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Oh boy! Thanks alot bro. :)
     
  39. Camelot63RU

    Camelot63RU

    Joined:
    Jul 20, 2014
    Posts:
    17
    Any news about update?

    just kidding, I'll go wait ;)
     
    redoxoder likes this.
  40. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Don't know if it's a bug or FEATURE :eek: but here's a question, why does reloading a weapon deduct 10 bullets from BulletInventory variable? Fire one bullet and reload, 10 bullets are deducted or fire 5 or 6 or 7 bullets and reload, 10 bullets are deducted. What's going on?
     
  41. Camelot63RU

    Camelot63RU

    Joined:
    Jul 20, 2014
    Posts:
    17
    coz reload like mafia, full mag
     
  42. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Okay so here's a fix for ammo reloading bug.
    In your Gun.cs script there's method called LoadMagazine on line 87.
    inside that method is this code:

    Code (CSharp):
    1. if (BulletInventory > 0 && LoadedBullets < MagazineSize)
    2.             {
    3.                 LoadedBullets = 0;
    4.  
    5.                 var addition = BulletInventory;
    6.                 if (addition > MagazineSize)
    7.                     addition = MagazineSize;
    8.  
    9.                 BulletInventory -= addition;
    10.                 LoadedBullets += addition;
    11.  
    12.                 for (int i = 0; i < Listeners.Length; i++)
    13.                     Listeners[i].OnFullyLoaded();
    14.  
    15.                 if (FullyLoaded != null) FullyLoaded.Invoke();
    16.  
    17.                 return true;
    18.             }
    19.             else
    20.                 return false;
    21.         }
    All you have to do is, Replace this above code with this given below:

    Code (CSharp):
    1. if (BulletInventory > 0 && LoadedBullets < MagazineSize)
    2.             {
    3.                 if (BulletInventory >= MagazineSize - LoadedBullets)
    4.                 {
    5.                     BulletInventory -= MagazineSize - LoadedBullets;
    6.                     LoadedBullets = MagazineSize;
    7.                 }
    8.                 if (BulletInventory < MagazineSize - LoadedBullets)
    9.                 {
    10.                     LoadedBullets += BulletInventory;
    11.                     BulletInventory = 0;
    12.                 }
    13.                
    14.  
    15.                 for (int i = 0; i < Listeners.Length; i++)
    16.                     Listeners[i].OnFullyLoaded();
    17.  
    18.                 if (FullyLoaded != null) FullyLoaded.Invoke();
    19.  
    20.                 return true;
    21.             }
    22.             else
    23.                 return false;
    24.         }
    FIXED FOR ME. ;)
     
    satchell likes this.
  43. dev01

    dev01

    Joined:
    May 3, 2010
    Posts:
    21
    Needs prone animations as another type of cover and this would be complete
     
  44. Autonoma

    Autonoma

    Joined:
    Jul 21, 2013
    Posts:
    92
    How can I use the mobile controls on the "Third person cover" scene? It seems the mobile controls are pretty tightly bound to the game type that is included in the mobile example (which is top-down). I'd like to use mobile controls in the more traditional third person scenario.

    Is this something simple to do or should I go down the road of making a custom solution/control scheme for this?
     
  45. Autonoma

    Autonoma

    Joined:
    Jul 21, 2013
    Posts:
    92
    Nevermind, I got an easy solution with Control Freak 2 (available on the asset store). I posted the previous post less than an hour ago, and in that time got the whole scene converted over to mobile controls... Control Freak is pretty awesome and a great add-on to this asset.
     
  46. JungWon

    JungWon

    Joined:
    Feb 15, 2013
    Posts:
    1
    This asset is very heavy. I even have lots of lag in the windows demo. How do I optimize it?
     
  47. Rohancr

    Rohancr

    Joined:
    Jan 25, 2019
    Posts:
    1
    Melee Enemies are taking damage each other.
    How to create separate layers for player and enemies?
    or any other way to stop this problem?
    coding level: Beginner
     
  48. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    486
    Start reading from a few pages back. You'll be up on the discussion.
     
  49. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170

    Does it help configure an xbox controller?
     
  50. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    I can seem to get the fire and scope inputs to work with an xbox controller - I've got all the others pretty well mapped out but not fire and scope. Any guidance?

    thanks,
    rich