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. SwbZay

    SwbZay

    Joined:
    Jul 14, 2015
    Posts:
    2
    Has anyone experimented with multiplayer here? I’m having a difficult time getting the guns to show over the network.
     
  2. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    As for Layers. Iv been struggling with this.
    I figured out how layer manager works...i think.
    Iv added the 2 layers in spot that they need to be and no compile issues, however....

    My scenario is i need to child a object for my MiniMap to my player.
    I then set that object to my MiniMaps layer.

    However when I press play they get shoved into the Player Layer, which leaves me with a player that has MiniMap sprites suspended at his waste...AND a camera thats not showing my sprites due to Masking... :(

    Why is this Child on Character being reassigned? I simply can't figure it out. I sent Ed an email but no response...
    Does anyone know? I don't think it's the bitshift in Layer.cs doing it: public static int MiniMaps = 1 << 12;
    That just sets layer by Binary and since its already set...it shouldn't actually do anything.
     
  3. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    So I'm gathering the latest versions that this works in are:

    2019.x.x beta - How stable is the beta...not too afraid to attempt it...
    2018.2.x - iirc it did for me prior to updating to 2018.3 release...
    2017.4.x - Would like to avoid going backwards...

    ...otherwise whats the update status here? (being fully aware the holidays just finished). Seems a lot of people are running into several non-trivial issues.

    -Steven
     
  4. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    @Paul-Swanson Can you use a tag or is it important that it's a layer?
     
  5. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    Because it's a camera I'd prefer to use layers. Since that's built in functionality. I'm not sure how to mask off tags for cameras.

    There's also possibilities in the future that I might want certain gameplay elements controlled or detected by layers*, so having them get overridden mysteriously is not ideal
     
    Last edited: Jan 4, 2019
  6. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    485
    Stopped at 2018.2.20 and is working fine. Tried using 2018.3 and it broke trying to use the new Prefab system. I don't believe it works properly with it.
     
    Last edited: Jan 5, 2019
  7. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Great thanks man.

    @EduardasFunka Speaking of which and considering we're moving onto 2019.x, whats the update plan then?
     
  8. Alexey1B

    Alexey1B

    Joined:
    May 15, 2017
    Posts:
    26
    Hello, are there approximate update release date? I have to do changes for my ai logic, and another minor things, but if i do it now, looks like after update ill have to totally change it (saw here comments about nodes for ai and suppose what it is not only one of changes). In case not soon update, but if core things done, maybe exists way to get it as is, for continue my work in future context?
     
  9. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    485
    Never sure when updates will come. Save any changed scripts to a separate folder and I like to use CodeCompare if your a Windows developer. It's a free(?) diff tool.
     
  10. Munken

    Munken

    Joined:
    Dec 28, 2013
    Posts:
    9
    HI Rahd
    i'm trying to implement Emerald Ai to my project. So far i can get the Ai to follow me etc. but did you find a solution to handle Damage?
     
  11. jandernunes

    jandernunes

    Joined:
    Nov 18, 2013
    Posts:
    5
    Hello everyone!
    I'm trying to use the zombie prefab, but I'm having trouble. The character tries to cross the wall permanently. How to avoid this situation? Anyone have ideas? Thank you!

    zombie1.PNG zombie2.PNG
     
  12. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    remove waypoints it looks to me it has no path to go to waypoint
     
    jandernunes likes this.
  13. jandernunes

    jandernunes

    Joined:
    Nov 18, 2013
    Posts:
    5
    Thank you very much.
    I'm still having problems, because the zombie in some situations can not avoid obstacles.
     
  14. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    rebake nav mesh
     
  15. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    Any ideas @EduardasFunka ?
     
  16. TotalPixel

    TotalPixel

    Joined:
    May 26, 2012
    Posts:
    19
    Hi,

    I am making a game using your template in a topdown shooter style. So far ive been able to code in a lot of stuff including controller support. I'm having an issue tho when trying to vault over a cover object. I am using cover objects from one of the sample scenes and and the a good guy character. The issue is that sometimes it seems to work ok but then others he seems to get stuck mid vault and turn backwards or cant get up enough to get over. It works fine a few times but then doesn't. I'm confused over how it does work but then doesn't. Is this a bug in the template?.

    Thanks
     
  17. jandernunes

    jandernunes

    Joined:
    Nov 18, 2013
    Posts:
    5
    Thank you!
    Sorry for the beginner questions.
    I had not set up the obstacles correctly.
     
  18. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    looking at profiler the character motor late update take 5-6ms to complete. Anyway to improve that ?
     
  19. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    485
    Give it a shot and let us know how it goes. We've been trying to optimize. ;)
     
  20. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Try using Update Manager.

    Link: https://assetstore.unity.com/packages/tools/update-manager-53581

    This worked for me and got rid of LateUpdate of CharacterMotor from profiler.
    Give it a try and see if this works.
     
  21. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    @EduardasFunka any news about next update and new features included in that update? Any specific date of release?
     
  22. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    A plan was 15 January... New AI is "working" I would say its late alpha stage.
    We now have 2 profiles (soldier and sniper) that act the same as previous AI but you can do lots of more customizations like add sounds with a simple node when AI spots enemies or when changing from cover state to assault state. When enemies spot a grenade you can tell AI to play specific panic animation before it jumps away from it and its very easy to see what happens inside AI brain and what options it has.

    We do not have melee, AI avoidance (AI avoid other AI in its path), Circle approach implemented. And we have some bugs. Search needs more work (previous search also not ideal).
    Also we need to make UI nicer plus tutorials documentation etc. We had no idea that unity UI will take so much time to deal with. Right now we decided to finish current UI but in future, we plan to replace with something better.

    Conclusion AI is HARD work, lots of testing, fixing, testing, tuning, testing, fixing...
    I believe we can make a truly solid product at the end just not sure when that end is coming at the moment.
     
    Rahd, Unplug, satchell and 1 other person like this.
  23. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    74
    Tuto will be Nice
     
    Rahd likes this.
  24. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    485
    Yeah, I tried the same thing a while ago. Got it working for the most part except for exiting the final animation.
     
  25. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Hello!

    I am having trouble with the Player getting stuck in a falling state. When the Player jumps or falls from a platform and hits the edge of another platform on the way down, the player seems to get stuck.

    Here are some screen shots of the player stuck in the corner of three platforms. I included shots with and without the colliders. Also from several angles.

    Screen Shot 2019-01-10 at 11.35.35 AM.png Screen Shot 2019-01-10 at 11.35.17 AM.png Screen Shot 2019-01-10 at 11.35.10 AM.png Screen Shot 2019-01-10 at 11.35.03 AM.png Screen Shot 2019-01-10 at 11.35.00 AM.png


    It almost seems like the Hit Colliders on the Player's Limbs are getting caught... Any thoughts?



    Thanks!
    -rich
     
  26. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Here's another example, the player attempted to jump between platforms and missed, but got caught on edge.

    Screen Shot 2019-01-10 at 11.51.29 AM.png Screen Shot 2019-01-10 at 11.51.10 AM.png Screen Shot 2019-01-10 at 11.51.03 AM.png
     
  27. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    And a video to show you in action:

     
  28. Jhorvath9

    Jhorvath9

    Joined:
    Nov 22, 2015
    Posts:
    9
    Maybe assign those colliders to a different layer and then in the collider matrix, have that layer ignore whatever layer the platforms are on (may have to assign the platforms to a new layer). I don't know if that will fully work but it's a possibility. I'm sure someone else has a better idea on how to make it work.
     
  29. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Thanks for the reply - I tried change the platforms to a different layer, but if they are anything other than default layer, then the player is stuck in "isFalling" state...

    -rich
     
  30. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    That would be great. And please add one more thing to this asset, HEAD TRACKING. There's no head tracking. If I aim towards my feet, my player just keep looking straight. May be I am missing something, I don't know.
     
    Unplug likes this.
  31. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    Quick question for the expert around here. When i change my terrain layer to anything else than default, the character start "gliding" (like the capsule is gliding since it has zero friction). I can't find any reference in the script that seem to control ground layer expect

    var count = Physics.RaycastNonAlloc(start, Vector3.down, Util.Hits, threshold + offset, 0x1);

    found in charactermotor.
    in "findgroundandslope" function.
    Let say my terrain is layer 25, what would be the correct "int" to put instead of 0x1 if it has anything to do with it ?
     
  32. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    0 x 1 = 0. I'm assuming that's a placeholder input to affect the variable?

    Have you tweaked it at all? 1x0, 0.25x1
     
  33. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    there's a confusion with the layer thing
    i think on the github he added Layers , and there's Layers.Geometry Layers.Character ..ect
    so the new code looks like this Physics.RaycastNonAlloc(start, Vector3.down, Util.Hits, threshold + offset, Layers.Geometry);
    this will solve a lot thanks !
     
    satchell likes this.
  34. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324

    I think melee AI should be skipped for now , the problem is the motor has a lot of necessary calls on the update ,
    but for example cover is called with melee , why would a melee take cover :p ... i think
    maybe the node system will fix this ,
    have them as modules , like invector , the dev there is selling modules for :
    Stealth Kill Add-on
    Melee Combat
    FreeClimb Add-on
    Footstep System
    Zipline Add-on
    Swimming Add-on .. ect

    this could make your life way easy , and you can earn more money if you split the package to modules
    and this could help us too , so we can add what we want and skip the not needed part
    and in the long run you can add more and more add-ons
    example the strategy top down example is really nice , but i'm not gonna use it

    however some will so make it a separate pack
    I'm gonna keep using your ai , i tried all , this on is the best so far .

    Please more focus on making it faster , your work is great and every update it get's better , keep it up
    and thank you .
     
    jnbbender and satchell like this.
  35. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    a quick fix is adding a physics material to the platform collider and play with the friction and bonce , this worked for me on 1.3 , not perfect but maybe it will work ,
    check if the right hand have a collider , i can see a box maybe it's holding the player
     
  36. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170


    I played around with this but I don't think it helped. It's hard to test as it seems inconsistent. But thanks for the suggestion!

    -rich
     
  37. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    I tried with a fresh copy of the cowboy character thinking I might have messed something up in my own character but still the same issue. See attached...

    thanks,
    rich





    Screen Shot 2019-01-12 at 2.06.49 PM.png Screen Shot 2019-01-12 at 2.06.43 PM.png Screen Shot 2019-01-12 at 2.06.38 PM.png Screen Shot 2019-01-12 at 2.06.34 PM.png
     
  38. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    it aint a multiplcation. It would be 0*1 and it would be totally useless. The line require a int that is used for a layer mask. 0x1 is a "bit flag" i just have no idea what value would mean to check for the right layer.

    I'm always confused about layermask and I ask the question because all my "try and miss" attempt was driving me crazy...

    @Rahd it would be logical to let the user be away of ANY setting like tag and layer that can affect the code and have us the option to change it easily. Took me forever to find that line and haven't been able to make it work yet. I try to keep my things organised. Haven't updated to latest code yet.

    I think performance and AI should be the only priority right now for Eduardas. It's hard enough that they should concentrate on that to get it out once and for all. He can deliver for sure.
     
    Last edited: Jan 12, 2019
    Rahd and satchell like this.
  39. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    @Unplug pardon my ignorance, thanks for clarifying!
     
  40. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    im probably more lost than you are :) don't worry i didn't meant to be rude. I'm just trying to find a solution... he's using hex value i guess its prettier in the code than just typing layermask.value

    @rrabassa we are looking at the same problem right now. make sure you check
    Code (CSharp):
    1.         private float getGoundHeight()
    2.         {
    3.             LayerMask layermask = LayerMask.GetMask("YOUR LAYER NAME"); //2019-01-11 layer terrain replace 0x1
    4.             var count = Physics.RaycastNonAlloc(transform.position + (Vector3.up * (0.1f)), Vector3.down, Util.Hits, layermask.value);
    5.  
    there are a couple of line that use default layer (0x1) for checking ground and ground height which is probably the one making your character fall ... not sure since i haven't figured it out myself.
     
    Last edited: Jan 13, 2019
    satchell likes this.
  41. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    I can't Freaking thank you enough !!
    Went from 40 fps on pc to 150 !!!
    life saver script and easy to use , any side effects ? (so far none)
    i think i messed up the code and this fix it some how
     
    Last edited: Jan 13, 2019
  42. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Can you reproduce it in our demo scenes? Move around and copy objects there to get something similar to your scenario.
    A character might get stuck for a variety of reasons, but it only shows a fall animation if there is no collider below feet that is in the default layer and is not a trigger.
    It looks like there is something making the character stuck but that something doesn't register as ground.
     
  43. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    @EduardasFunka please help me dude.

    1- When i fire a bullet sometimes (combination of recoil, body position et badluck) the ray hit the player. Where do i need to set the raycast and bullet collision to avoid layer "character". Friendly fire should be a on and off option that require us to select player layer ennemies layer.

    2- Please explain us how can we change the layer of the terrain and still have it detected by the character motor. Changing the 0x1 to layermask.value didn't work. It was detecting ground but it was stuck in falling animation. My ground will be a combination of two layer and it would be essential to be able to fix that.

    @Rahd so happy you tested it ! i was scared to try since it was pretty old. Will try it too :) Do you have a devblog for the game you are building. you seem very skilled. UPDATE : i installed the asset but was unsuccessful. It require a lot of change and i tested it on a pooling script and it didn't work. First i can't specify the awake function like in the readme and it cause trouble reading some dictionnary from one class to another and it fail to work. I would be pretty cautious about it... That said, can you tell us, what file have you change in third person cover system to get a huge gain in performance ?
     
    Last edited: Jan 14, 2019
  44. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    0x0 = layer 0 = first layer on the list

    0x1 =layer 1 = 2nd layer on the list


    here is from 0 to 99
    0x0-0-0x14-20-0x28-40-0x3C-60-0x50-80-0x1-1-0x15-21-0x29-41-0x3D-61-0x51-81-0x2-2-0x16-22-0x2A-42-0x3E-62-0x52-82-0x3-3-0x17-23-0x2B-43-0x3F-63-0x53-83-0x4-4-0x18-24-0x2C-44-0x40-64-0x54-84-0x5-5-0x19-25-0x2D-45-0x41-65-0x55-85-0x6-6-0x1A-26-0x2E-46-0x42-66-0x56-86-0x7-7-0x1B-27-0x2F-47-0x43-67-0x57-87-0x8-8-0x1C-28-0x30-48-0x44-68-0x58-88-0x9-9-0x1D-29-0x31-49-0x45-69-0x59-89-0xA-10-0x1E-30-0x32-50-0x46-70-0x5A-90-0xB-11-0x1F-31-0x33-51-0x47-71-0x5B-91-0xC-12-0x20-32-0x34-52-0x48-72-0x5C-92-0xD-13-0x21-33-0x35-53-0x49-73-0x5D-93-0xE-14-0x22-34-0x36-54-0x4A-74-0x5E-94-0xF-15-0x23-35-0x37-55-0x4B-75-0x5F-95-0x10-16-0x24-36-0x38-56-0x4C-76-0x60-96-0x11-17-0x25-37-0x39-57-0x4D-77-0x61-97-0x12-18-0x26-38-0x3A-58-0x4E-78-0x62-98-0x13-19-0x27-39-0x3B-59-0x4F-79-0x63-99
    did not test it https://www.aqua-calc.com/convert/number/hexadecimal-to-decimal
     
    satchell likes this.
  45. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Screen Shot 2019-01-13 at 10.36.53 AM.png
    I'll try and reproduce in your demo. But I'm sure there's nothing under the character in these cases.
     
  46. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    485
    How did you implement this? I tried putting it on the LateUpdate of the character scripts but this only seems to work when there are multiple instances of an object.
     
  47. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Does anyone have an easy way to add a “hanging” state where th player can jump and catch an edge and pull himself up?
     
  48. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    @Rahd , is it literally just as easy as switching out MonoBehavior with OverridableMonoBehavior and adding Me to the end of each update method type? Or was there something more to it than that?
    I keep getting this and have no idea what it even means:
    Cannot access protected member 'OverridableMonoBehavior.Awake()' via a qualifier of type 'OverridableMonoBehavior'; the qualified must be of type 'CharacterMotor' (or derived from it)

    You and @umair21 obviously solved it. But I'm stuck
     
    Last edited: Jan 14, 2019
  49. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    485
    Not sure but it looks like your calling Awake as a static method for your first line. I believe you need to call base.Awake()
     
  50. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    LoL! Yeah! No side effects yet. :)