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. Our response to Improbable’s blog post (and why you can keep working on your SpatialOS game). Read more 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

New Standard Asset Characters - Third Person

Discussion in 'Editor & General Support' started by willgoldstone, Apr 13, 2018.

  1. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Hi James, this one is very much in development, so rolling back the version to open it with is not recommended. We are developing on latest release which at the time of writing my last post was 18.2.18. Recommend getting that or .20. Rolling back to older versions will just give you issues and editing the manifest as you are suggesting @Jim_West simply means you're going backwards in the stability fixes for input system and other elements you edit so also not recommend - though I totally commend you for trying to fix and help out of course!
     
    JamesArndt likes this.
  2. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
  3. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,530
    Thanks, I totally understand that. I'm grateful we're getting some upgraded character controllers!
     
    willgoldstone likes this.
  4. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    57
    So I just have one problem with this. Running up and down stairs that have a non-convex mesh collider just is not right. The character jitters when going up and just falls of when going down( like falling down mini cliffs).
     
  5. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    730
    Seems like this will be a huge improvement over the current standard assets controllers. The third person one in particular is feeling pretty darn good at this point. My one big complaint is that it seems you are forced to use root motion for the third person controller. For some styles that's probably preferable, but it would be nice to have the option to not use root motion and have direct control over movement speed parameters.

    Similarly having to modify the jump height map curve is inconvenient. Seems like that curve should be normalized and there should be a scale parameter to adjust actual jump height.
     
    JamesArndt likes this.
  6. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,797
    The difference between Prince of perisa and Mario:

    Prince of perisa has to finish his animation before he can jump.
    Mario can jump anytime.

    Wich one controls more direct?
    Mario

    Wich one has smoother animations
    Prince

    Idealy we should be able to choose between those, or even better blend between them.

    With a prioritiy for control before an animation state can finish.
     
    TheValar likes this.
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    24,173
    Well, it's never all or nothing, With root motion animator, you get a callback for before the root motion takes place, so you can make the mario decision if you so choose there, for instant response.

    This control has always been available.
     
    Lars-Steenhoff likes this.
  8. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,797
    :cool: But will it look as good as the dog video from a few posts back?
     
    hippocoder likes this.
  9. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    24
    I managed to make SAC 's ThirdPersonController work with KCC (replace OpenCharacterController with KCC), things are going well


    moving platform also works like a charm:
     
    PhilSA and willgoldstone like this.
  10. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    36
    Am I just blind or isn't there any way to define the base speed in the third person controller? (like the sprint multiplier for example) It would be great to set the max base speed to walking for example. If that's what the forward speed range slider in Ground Movement is for, it doesn't seem to work (It doesn't have influence on the Animator at least..)
     
  11. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    36
    Oh that looks great, could you give us some details about it? (I have the KCC too and would be very interested how to combine the two :) )
     
  12. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    24
    it's eaier than i think, just make ControllerAdapter to use a KCC based Controller, here are some code:

    in CharacterBrain.cs change code to this:
    Code (CSharp):
    1.  
    2.         public void Move(Vector3 moveVector, float deltaTime)
    3.         {
    4.             isGrounded = useKcc ? kcc.Motor.GroundingStatus.IsStableOnGround : characterController.isGrounded;
    5.             AerialMovement(deltaTime);
    6.             if (useKcc && m_VerticalVector.y > 0f)
    7.             {
    8.                 kcc.Motor.ForceUnground();
    9.             }
    10.             MoveCharacter(moveVector + m_VerticalVector, deltaTime);
    11.             m_CachedGroundVelocity = moveVector / deltaTime;
    12.         }
    13. ...
    14.         void MoveCharacter(Vector3 movement, float deltaTime)
    15.         {
    16.             if (useKcc)
    17.             {
    18.                 kcc.targetVelocity = movement / deltaTime;
    19.             } else
    20.             {
    21.                 var collisionFlags = characterController.Move(movement);
    22.                 if ((collisionFlags & CollisionFlags.CollidedAbove) == CollisionFlags.CollidedAbove)
    23.                 {
    24.                     m_CurrentVerticalVelocity = 0f;
    25.                     m_InitialJumpVelocity = 0f;
    26.                 }
    27.             }
    28.         }
    kcc is a Class inherits kcc's BaseCharacterController, you only need one line code:
    Code (CSharp):
    1.  
    2.     public override void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime) {
    3.         currentVelocity = targetVelocity;
    4.     }
    5.  
    some field like startedSlide, radius etc.. use kcc's corresponding api:
    Code (CSharp):
    1.  
    2.         public bool startedSlide { get { return
    3.                     useKcc ?
    4.                     kcc.Motor.GroundingStatus.FoundAnyGround && !kcc.Motor.GroundingStatus.IsStableOnGround :
    5.                     characterController.startedSlide; } }
    6. ...
    7.         float radius { get { return useKcc ? kcc.Motor.radius : characterController.scaledRadius + characterController.GetSkinWidth(); } }
    8. ...
    9.  
    10.         LayerMask collisionLayerMask { get { return useKcc ? kcc.Motor.CollidableLayers : characterController.GetCollisionLayerMask(); } }    
    11. ...
    12.  
    13.             isGrounded = useKcc ? kcc.Motor.GroundingStatus.IsStableOnGround : characterController.isGrounded;
    14.  
    you may also change some code that change rotation directly to use `kcc.Motor.SetRotation()` method, e.g. in TurnAroundBehaviour.cs

    full changes are crossing multiple files with some my own specific change, hope the description above help you.
     
    Last edited: Jan 5, 2019
    willgoldstone and Vincent13122 like this.
  13. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    36
    Thank you! looking forward to test it :)
     
  14. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,834
    First time I noticed this. I would like to see more interfaces with more stuff abstracted out. More attention to performance.

    Right now a number of third party assets beat this in both features and performance. And by features I mean core features not just tangentially related. And it won't be long until we see one or two of those take what they have and move it to ECS and the new job friendly physics api's also. How is this project going to compete with that? Especially in light of how sporadic the development is?

    It doesn't really matter how much better this is compared to the old controller. Nobody cares about that. It's how does it measure up against the best modern implementations using currently available api's. Both from the perspective of what's available on the asset store as well as those looking to implement a controller themselves. It it can't complete on those grounds, then it's really not in a better state then the current standard assets controller in terms of who will use it.
     
  15. Mattias1337

    Mattias1337

    Joined:
    Aug 13, 2017
    Posts:
    1
    Agree it looks good. I have tested it out and it works quite well. However, for me I ended up writing my own in any way. Some things was missing. Like configuring how slopes should be handled up and down, how moves over steep edges should be handled. Should the character lift from ground like flying over a steep edge (like being part of the physics just there) or follow the ground more exactly.

    I also would like to have more Gizmos to se where ground hit occurs, where raycast hits when characters are falling, top, bottom, size (standing, grouching), orientation (standing, swimming) etc. of capsule (capsule collider is enough).

    The behaviour (character interaction with environment, collisions etc), animations and movement can be separated but interchangeable between the different parts with for example events or other mechanics.

    Completely customisable extendable and component based character system is what I want. :)
     
  16. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    57
    I just took a look at the strafe locomotion blend tree. Why is it so complex? I cant even wrap my head around it. How are we supposed to fit in custom animations into that?
     
  17. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Hey Rog, answering your questions in order. 1 - yep, we have an update coming hopefully today or tomorrow from Cinemachine team. 2 - Great! 3 - Given that this is Root motion, we can scale but sounds like you already saw that Root Motion scale setting, not sure if you're asking for a completely differently driven character here?
     
    Rog likes this.
  18. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Hi! Yes we did choose root motion in this instance, but we feel like we got a fairly flexible result - happy to be corrected on this, I know not everyone is going to be happy with this approach, its partially why we remade the CharacterController component in C# too in order to make that more tweakable if people want to build a differently made one from ground up.

    Regarding curves - we chose this to give more flexibility - keep in mind that the curve isn’t the jump itself - its a curve that lets you adjust the jump height based on current speed of the character.
     
  19. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Hi! Answering your points in order -

    1. yes easily, you can simply retarget the controller to your own rigged character.

    2. yes you could cut down on parts of the blend trees that we have - for example removing strafe, but if you're talking about retargeting, you don't need the intended character to have animation anyway - apologies if i've misunderstood the question.

    3. you could swap for an animated animal and keep the C# character controller, you’d be ditching all the humanoid stuff.

    4. Touch is a yes thanks to the new input system - this is in development and we can show you more of this soon. As for AI Input - there is a nav mesh controller example scene in the project already, though the camera is currently buggy.
     
  20. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Good point, now fixed, pushed to Beta Fixes branch, will merge soon.
     
  21. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    This is awesome feedback thank you so much! Answering in order -

    1 is fixed and pushed to Beta Fixes branch.

    2 should be fixed with our new “grounding” solution that should be done today
     
  22. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Rog likes this.
  23. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Hi there - sorry but you've encountered one of the nastier New Input system bugs we have at the moment, expect this to be fixed in an update to that - keep an eye on package manager. It is intermittent for me at least - how about you?

    Regarding Camera stuff - hold fire until we push a) fixes our dev team made to cameras in sample scenes (coming today to Beta Fixes branch) and b) our Cinemachine proper update from CM team hopefully today or tomorrow.

    Thanks for the feedback :)
     
    ceebeee likes this.
  24. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Honestly, we're aligned with you on this topic - we think that stuff like this is game specific so you should consider it something that you may want to tweak yourself.

    Note that if someone wants to push an option for this, we'll totally review PRs.
     
  25. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Should be fixed in Beta Fixes branch, take a look!
     
  26. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Hi Lars, thanks for your feedback. I haven't played Prince of Perisa for a long time, but yes you're articulating the classic trade off in character controllers we face - I like what you’re asking for actually - the practicality of this is that the character looking slightly realistic requires us to find that balance - we think we’ve done a decent job that’s more inspired by Zelda BOTW. It’s a somewhat realistic humanoid character that prioritizes responsiveness. I will think more about how we could achieve simplification of this but in reality its a few properties that go into making this and a ton of balancing work with any change.
     
  27. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    I think you're looking for Root Motion Scale in the Third Person Brain component... we might want to rename that but right now it's technically accurate if not great ux.
     
    Rog likes this.
  28. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Hi Snacktime! Thanks so much for doing the benchmarking work for us, this is really appreciated. Can you share which assets you tested and where the current state of the project ranks in terms of performance / features? Any form you have even if its just text notes are helpful.

    Also totally agree with your point about ranking this against current games not against old products.

    Cheers!
     
  29. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Hi Mattias, we have made some edits to the grounding of the character, I wonder if this helps with what you wanted? please see the Beta Fixes branch.

    Re Gizmos - also great feedback, we’re gonna look at adding a bunch more Gizmos and allowing you to toggle them with checkboxes in inspector.
     
  30. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    This is in our view the best way to do it - it looks complex because we have a number of transitional animations to allow to and from strafe with a decent look to it. What kind of custom animations are you trying to 'fit in' ?
     
  31. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    24

    Just some thoughts, when i try to do some network stuff, RootMotion brings real problem to me.

    currently, SAC use a `Update() -> AnimationParams -> OnAnimatorMove() -> actual movement` way to drive OCC, we actually can't simulate multiple movement in one function call (because of unity's internal animation update process), client-side prediction become nearly impossible.

    maybe the solution is implement an asynchonous simulation process, but it's really difficult to achive an asynchonous Command Frame System (which is common in networked game).

    Or maybe there is a way to eliminate OnAnimatorMove call and force update animator to get animator.deltaPosition? (i tried calling `animator.update(0f)` but seems not working)

    For me matching speed is much easier than RootMotion, so i'll try to eliminate OnAnimatorMove use (also can save some server-side cost maybe?)
     
    Last edited: Jan 10, 2019 at 4:29 PM
  32. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    507
    Where is the Import Package? I can't seem to find it, and copying the _Standard Assets folder results in bad materials.
    Importing the Package
    • Import the SAC package.
     
  33. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    507
    Partial feedback - It is very difficult to add additional actions (whereby an action might be similar to how you've added Jump or Strafe). From my initial look, it appears as though adding new actions/movements would require a number of scripts to be modified/changed/edited to make this function appropriately. Therefore, my partial feedback would be to make this easier to implement. The list of "actions/movements" will definitely be based on what someone is trying to do, but right now it takes a ton of effort to do this (unless I am missing something completely). For example, I might want to implement Crouch or Shooting or Opening a Door or Entering a Vehicle (thereby triggering a separate vehicle controller).

    Thanks. Just my partial feedback all intended to be friendly and open.
     
  34. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    910
    Implementing robust moving-platform support was a pretty massive endeavour in my experience, and not something most users would want to have to mess with. Actually I think roughly 2/3 of the time I spent on my entire CC was trying to implement proper moving-platform and rigidbody-interaction support. Some people do it by just setting the character as child of the platform transform, but this method is extremely limited and can cause countless problems

    Implementing this caused a lot of design/architecture changes in my CC, so I would assume it might possibly be the same for this CC too. What I'm trying to say here is that if you don't implement that feature, many users who will try to implement it on their own may end up realizing that it's actually impossible with the current design to do this well and efficiently. I think it would be important for you to validate that it is in fact possible by prototyping the feature, and the sooner the better (to avoid massive refactors in the future)

    I feel like it would be important to have support for this in a standard assets CC. It is pretty common in games to require characters to stand on kinematic or dynamic rigidbodies such as elevators or on the roof of a moving car

    I don't have a well-prepared explanation for why exactly moving platforms and physics interactions are complicated at this moment, but the bottom line is that it will probably require you to cut your CC logic into several separate phases and impose a very explicit control over when certain parts of the CC movement logic are executed, when the physics is simulated, when moving platforms process their movement, etc... all these steps will be interlaced with each other and must be done in the right order
     
    Last edited: Jan 15, 2019 at 10:25 PM
    mark_cb likes this.
  35. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    910
    It should be possible to create a CC that supports both rootmotion and direct movement without sacrificing anything. All you need is to make it so that users work with the CC by telling it which velocity it should be having at this frame (not sure if that's the case here, haven't investigated enough)

    As long as you have this mecanism, you can do both approaches:
    • (direct movement) write a simple script that sets the CC velocity based on inputs
    • (rootmotion) write a simple script that sets the CC velocity to whatever the velocity of the rootmotion is right now
     
    mark_cb likes this.
  36. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    24
    Actually, RootMotion driven makes proper networking CC a nightmare, because we often have different FrameRate between Movement & Animation...

    Also, i'm curious about you saying "countless problems" about parenting style moving-platform, can you give us some explanation or problematic cases ?
     
    Last edited: Jan 16, 2019 at 9:00 AM
  37. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Thanks this is good feedback we'll be looking into. Appreciate you taking the time, our team on this are reading each response and we have meetings to discuss so we will cover this.
     
  38. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    668
    Hey Phil this is great feedback, we'll take a look through this in our next meeting and discuss it in more depth and come back to you.