Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Third person cover controller

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

  1. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    45
    Hey @timinal, ws just elaborating on my post per jnnbender's request. Your code is a great solution. I guess jnnbender Is looking for the root that controls the rotation.
     
  2. timinal

    timinal

    Joined:
    Jul 19, 2012
    Posts:
    11
    Ah, I see. :)
     
  3. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    229
    my camera starts at the foot so instead of slowly lerping to the head it quickly jumps to the head. That tells me the problem is before UpdatePosition.
     
  4. Jeomar

    Jeomar

    Joined:
    Jun 30, 2017
    Posts:
    4
    Hey everyone! Hope everyone excellent Christmas and New Years. I have a couple questions, is it possible to swap out the cowbow character and put my own in? How easy is it to set up?
     
  5. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    229
    Sorry for the last AddCover.cs script. It was a mess. It did not take into account different meshes, positioning was messed up. I performed a few more tests with this one against trees and such. Hopefully this works out for everyone.

    EDIT:
    I don't feel like posting another script. You may get some camera shake. If you do change the "new Vector" localScale z position from 0.05f to 0.1f. Also, turn up the BUFFER_VALUE to something like 0.07f
     

    Attached Files:

    Last edited: Jan 5, 2019
    Blackghost likes this.
  6. TotalPixel

    TotalPixel

    Joined:
    May 26, 2012
    Posts:
    15
    Hi, does anyone know of a way where i can switch the mobile controls from using touch input to using xbox controller sticks instead. I want the movement from the mobile scene.

    Any help appreciated :)
     
  7. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    229
    If you go to the Asset Store you can catch all his videos. This one
    is for the Character setup. It's the most recent one I can find. He doesn't explain anything, just mumbles so copy and paste as he does and you'll pick it up later.
    This process is known to be a pain so @StaticWave wrote a great utility to auto setup a Character. Check it out on page 29 https://forum.unity.com/threads/third-person-cover-controller.472313/page-29. Look for the Pink.
     
  8. SwbZay

    SwbZay

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

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    194
    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.
     
  10. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,441
    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
     
  11. satchell

    satchell

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

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    194
    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
  13. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    229
    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
  14. SteveB

    SteveB

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

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

    AbelWhite

    Joined:
    May 15, 2017
    Posts:
    19
    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?
     
  16. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    229
    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.
     
  17. Munken

    Munken

    Joined:
    Dec 28, 2013
    Posts:
    1
    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?
     
  18. jandernunes

    jandernunes

    Joined:
    Nov 18, 2013
    Posts:
    3
    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
     
  19. EduardasFunka

    EduardasFunka

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

    jandernunes

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

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    402
    rebake nav mesh
     
  22. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    194
    Any ideas @EduardasFunka ?
     
  23. TotalPixel

    TotalPixel

    Joined:
    May 26, 2012
    Posts:
    15
    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
     
  24. jandernunes

    jandernunes

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

    Unplug

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

    jnbbender

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

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    64
    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.
     
  28. umair21

    umair21

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

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    402
    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.
  30. redoxoder

    redoxoder

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

    jnbbender

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

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    157
    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
     
  33. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    157
    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
     
  34. rrabassa

    rrabassa

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

     
  35. CrazedArabMan

    CrazedArabMan

    Joined:
    Nov 22, 2015
    Posts:
    4
    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.
     
  36. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    157
    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
     
  37. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    64
    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.
  38. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    150
    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 ?
     
  39. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    45
    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
     
  40. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    211
    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.
  41. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    211

    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.
  42. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    211
    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
     
  43. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    157


    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
     
  44. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    157
    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
     
  45. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    150
    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 at 11:22 PM
    Rahd and satchell like this.
  46. satchell

    satchell

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

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    150
    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 at 3:59 AM
    satchell likes this.
  48. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    211
    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 at 9:04 AM
  49. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    402
    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.
     
  50. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    150
    @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 at 2:27 AM