Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Third person cover controller

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

  1. Darkhitori

    Darkhitori

    Joined:
    Jan 7, 2015
    Posts:
    12
    How about adding a game mechanic where the player can dive/dash/roll/run to cover based on distance (a sort of auto navigation) by shooting a raycast to the aim target onto cover you want to hide against and quick transitions to nearby covers would be awesome as well!
     
    EduardasFunka likes this.
  2. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    866
    anyone know how to get the enemies to attack your player? I have been searching for ages and not found out how that works.
     
  3. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    60
    Just discovered this asset over the weekend, looks great!

    I have a very simple question; does this asset support gamepad controllers out of the box? If so this is an instant buy for me :)

    Cheers,

    Simon
     
  4. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    Your website don't have any messaging I think. I had to start a conversation to ask you a question last week....still no answer. So not sure if you are doing support from here or there !
     
  5. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Set Actor team 1 enemies 0
     
  6. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    I use forum or email to give support. those website messages are buggy I turned that off.
     
  7. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    HI Simon No, but its simple to set up.
     
  8. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    308
    Can you add jump animation with more high level of obstacle ?
     
  9. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    How do you enable sprinting with the topdown controller ?
     
  10. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    For support use email guys. Please.
     
  11. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    To add sprinting you'll have to modify the MobileController. It passes movement commands to the CharacterMotor via a CharacterMotor.InputMovement function. The command itself is a CharacterMovement struct which contains a property called Magnitude. Setting it's value to 2 makes the character sprint.
     
    f1chris likes this.
  12. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    You can increase strength to jump higher or lower gravity
     
  13. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    This was pushed as expected ? a store update should come up in ext few days ?
     
  14. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    866
    Unfortunately it still doesnt work, everything seems fine but he will not attack me like the cowboy. I appear to get a null pointer at friend.AI.IsAlerted && in AISituation line 268.
     
    Last edited: Oct 24, 2017
  15. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    866
    A game I am writing using this awesome asset.
     
  16. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    Hey @Ukvedys I bought your controller last night, pretty good so far. Just messing around with the camera states at the moment and noticed the "Zoom" state on the main camera when adjusting my rifle. Made me think, it's just going to use the same zoom state regardless of whether your using an assault rifle, pistol or sniper rifle?

    Wouldn't it be better to move the Zoom camera state to the Gun script, that way the zoom state can be defined per weapon? May need to do the same with the various cover camera states too?
     
  17. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I'll try to make the AI not use covers for some characters using a shotgun going to close range.
     
  18. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    Any plans on adding head look, so when your not aiming and you move the camera around, the character's IK looks in the direction of the camera?

    Curious about the default movement state also, with these kinds of third person controller you normally have an "adventure" style movement when not aiming, as in if your press back the character runs towards the camera zelda style. At the moment its a constant aiming style where the character always strafe. Any plans to add adventure style in the future?
     
  19. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    @Ukvedys whats the deal with the layers? Cover is assigned the cover layer but it still works even if its Default layer as long as it has the cover and box collider components?

    Does the player and AI have to be on the Dynamic layer?

    I ask because there seems to be an issue walking up ramps, as you walk up the player tends to "pop" up randomly. And if you stand on a ramp and not move, the players transform.y continually increases. Almost as if the capsule collider or raycasts are hitting the wrong layer....
     
    Last edited: Oct 25, 2017
  20. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    Hi @Ukvedys ,

    I'm a bit confused. I'm trying to replace your mobile controller with another joystick controller ( rewired). It's usually straight forward when having to read the regular input axis ( GetAxis("Horizontal") by example).

    In your case, you're not reading those input and doing your own stuff TouchBase.Update() function where if Application.isMobilePlatform is true you're then processing all Input.GetTouch().

    So I'm not sure exactly where to place my Rewired code to read the Movement Axis "Horizontal" & "Vertical".

    Any help please !!?

    thx
    Chris
     
  21. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    HI no it was delayed working on performance bit more
     
  22. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    That's an idea!. need to think about it. Thanks
     
  23. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Right now we do not plan this feature. Will investigate how long it may take us to do and let you know.
     
  24. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Please send me an email with little bit more information. with screenshots pls
     
  25. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Guys for support please use this email: .eduardas.ninja[Et]gmail.com
     
  26. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    In all respect, it's not the main purpose of the forum here to support, ask questions and automatically share it with the rest of the community ? If we go by email we'll all loose that value added.
     
    angel_m, AshyB and Gametyme like this.
  27. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538

    I was digging it to move it to joystick also. The input is mobile , if you look at Canvas object you can find all controls.
    I have switched to another game project, but i'll take a look again and post the solution if i get it working.

    Anyway @Ukvedys could include in the top down version the joystick option :rolleyes:
    I'm pretty sure more people will be interested in top down with joystick.


    I agree with @f1christian , all other users won't access to valuable plugin information if solutions to requests are only given throught mail.
     
    Gametyme likes this.
  28. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
  29. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    The touch inputs are just for that - touch controls, it's for capturing the player input on the screen via the Unity canvas system.
    Movement is passed to the motor via the CharacterMotor.InputMovement function. It requires a single argument of a CharacterMovement type. It contains two fields, one for the direction in the world space and other the speed. 0.5 speed means walking. 1.0 running, 2.0 sprinting.
    To make the character move you only have to build the CharacterMovement object and pass it to the _motor via the InputMovement.
    There is already a place in the MobileController that does it for the touch input, you can comment it out or replace with your own. It does touch input only if the property hasMovement (meaning the player is using the touch ui) is true. There is some additional code that helps the character stick closer to the cover when there is no player input (it also used the InputMovement).
     
    zenGarden likes this.
  30. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    The cover layer is used by the AI to find surrounding covers in a more optimal way. It uses OverlapSphere function only with the cover layer and therefore avoids having to use GetComponent on a lot of irrelevant objects..
    There was a reason for the existance of the Dynamic version in older versions of the asset. It will be removed soon.
    We will fix the ramp issue in the upcoming versions.
     
  31. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    about support in this forum.
    The idea was to give support once i know people purchased asset I can ask them for the invoice number.
    Maybe is not right idea not sure
     
  32. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    ok thx @Ukvedys

    I'll give it a try. Wasn't sure if I was missing something or what. It's well coded BTW and good logic separation, should not be too complicated.
     
  33. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    I understand your concerns. But there's no way, based on purchase information Unity is giving you to link our ID here with our purchase order ? I'm not a asset vendor so don't know how it works.

    EDIT: sent you my purchase order number by email
     
    Last edited: Oct 25, 2017
  34. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    558
    Maybe we could pm the invoice number? That's the another asset developer does it.
     
  35. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    The best way, would be Unity able to link any Asset Store item forum thread with some user verification invoice when they start to post o the item thread.
    For example you would have some smal sign on user forum avatar like some green circle shape meaning the user have purchased the item.

    Anyway, maybe you can set a new rule :
    - Anyone can ask general questions about the asset
    - People asking features or support in this thread must first send you their invoice number

    It looks good to me if it can avoid you loosing time with people not owning the plugin.
     
    f1chris likes this.
  36. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    Reading solutions to other peoples problems does help me prevent having those same problems in the future. Trouble is, usually by the time I read all the pages in a thread I've seen the same question asked fifty times :D
     
  37. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    I like that. Maybe @Ukvedys you can contact other Asset developers and try to have a discussion with Unity on what's your problem and what kind of of solution can be applied. I'm sure they'll have their ears wide open to help their developers. After all, if you're pirated, Unity is as well. Start to propose a solution like @zenGarden proposed.

    Just my 2 cents
     
    Last edited: Oct 26, 2017
  38. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    @Ukvedys can you move the "Always Aim" toggle from the Third Person Controller script to the Character Motor script. That way I can enable it to help set up the AI characters weapons (move/rotate) as well as the players.

    And a debug ray to show where the AI is aiming would be helpful for lining up the weapons so they point in the right direction.
     
    Last edited: Oct 26, 2017
  39. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    @Ukvedys I've been having a problem trying to get the AI to use cover. It keeps saying "couldntfindabettercover".

    I've put the cover object in, just a cube, 10x2x1 with the box collider and cover component. On Layer Cover. Baked the navmesh with 0.4 radius (same as your demo). Everything looks good but the AI just doesn't want to use it. Not even your demo AI which i copied and pasted wants to use it.

    I must be missing something somewhere. One thing I did notice when looking through your scripts was line 299 in Positioning.cs. You use a hard coded 0x1 << 8 for the layermask. I would think a lot of people download these kinds of assets from the store and choose not to import the editor settings. I know I sure don't like other peoples assets changing my settings so I had made the Cover layer myself and put it in layer 9 because 8 was already in use.

    I suggest changing line 299 to controller.transform.position, controller.Cover.MaxDistance, controller.coverLayer, QueryTriggerInteraction.Collide and then putting a public LayerMask coverLayer in the AIController.cs.

    Might be more flexible :) or at least doing the LayerMask.NameToLayer("Cover") approach.
     
  40. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Did you rebake nav mesh?
     
  41. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    The philosophy is that the motor avoids doing things by itself, it has to be commanded to act in certain way, that helps avoid messy code and eases the separation of concerns. We can add the Always Aim toggle to the AI controllers instead.
    We usually have debug rays when developing but remove most of them on a release. Thanks for the suggestion, we'll leave them on releases and have an option to turn them on.
     
    AshyB likes this.
  42. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It's not @Ukvedys issue, it's also for some other plugin developpers that got somewhat sensible to that like Ice Creatures plugin developper. It's up to Unity.
    Anyway sending our invoide number i think is a good way when the asset developper feels they have too much support to do (strange Tps cover system has only two pages thread since it's launch , this doesn't look so big support work :rolleyes:).
     
  43. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    Yeah. The AI has no problem moving around. Doesn't report any errors. Just doesn't want to use the cover objects...hmm... any suggestions?

    All good think I figured it out. The box collider isTrigger kept getting reset by another asset. Works well. Works with the new runtime navmesh baking components too.
     
    Last edited: Oct 26, 2017
  44. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    Yes I understand it's all the devs in the same basket. Was just trying to point out if you're 3-5 or 10+ devs pushing for new features/enhancements you have more chances.

    Enough said, think we derailed the thread :)
     
  45. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    A very easy fast way to check if someone asking a feature or bug support baught the plugin is simply checking if he written a plugin review on the Asset Store.
    Only plugin buyers can writte a review if i am not wrong :)
     
    Last edited: Oct 27, 2017
    f1chris likes this.
  46. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    Hey @Ukvedys I've been playing with your scripts and managed to implement an adventure style control system which doesn't require any new animations. And also added Rewired support for gamepad controls. I'll email the scripts through to you so you can see what other people use your asset for, might give you some ideas :)

    Feel free to use whatever you want from it to make this asset better/more flexible/extensible .etc
     
    Last edited: Oct 29, 2017
  47. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    257
    Would you mind to share your controller code for Rewired ?

    thx
     
  48. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    I would but it ties in with the code from redbee, so can't publicly share it without showing his code (I couldn't make it completely separate the way things are set up). But i sent it to the dev so maybe they can clean it up and make it officially supported or send you the example I sent them :)

    Also got shoulder camera swap set up. So press the left thumbstick in on the xbox one controller and the camera changes shoulders. Only took like 5 lines of code, takes the original CameraState for whatever pose your in and inverts the x offset. Looks good, wish I had the animations to go with it ;)
     
    Last edited: Oct 29, 2017
  49. DoenitZ

    DoenitZ

    Joined:
    Oct 23, 2012
    Posts:
    16
    Hi! I think this asset is very, very good.
    I am a buyer of the Mobile version of this one :
    https://www.assetstore.unity3d.com/en/#!/content/94227

    Sorry to comment on this thread, but the other one doesn't have as many replies as this one

    The asset labeled as a "mobile" asset, but it seems to be very poorly optimized for mobile.

    Any ideas or tips on how to improve frame rate with this?

    As a first thing that I've noticed, is that there are a couple late updates that are too overkill for mobile, but haven't dig deeper yet. Before doing a full optimization of this asset, one that will be very time consuming, I prefer to ask, if maybe I forgot to set or configure something to achieve better performance.

    Thanks!
     
    zenGarden likes this.
  50. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    153
    The asset is still pretty new as far as I can tell, so theres a lot of room for the dev to improve which I'm sure they'll get around too eventually.

    One thing I did notice was there's a few calls to Camera.Main in the loops instead of caching the result, and Camera.Main uses an internal GameObject.Find(), so its slow to use every frame. According to the manual;

    "For performance reasons, it is recommended to not use this function every frame"

    There's probably other similar code that could be redone. And you do need some LateUpdates() ;)

    One of the best things about this asset tho is its fairly easy to understand and modify, some of the other TPS assets have so much code in them it takes you days to figure out what everything does :p

    Can't really tell you any areas to improve, I'm using it for desktop so got plenty of frames to spare.