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

[Released] Kinematic Character Controller

Discussion in 'Assets and Asset Store' started by PhilSA, Sep 29, 2017.

  1. FcsVorfeed

    FcsVorfeed

    Joined:
    Aug 15, 2014
    Posts:
    50
    unity 2019.2 has a very terrible lag

    if I create prefab,when i click the prefab in project view,the Inspector will very slowly and lag, I can't do anything this is a very good asset, i hope can fix this problem thanks very much
     
    LezCT likes this.
  2. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Yeah I have seen that bug in the newest version of 2019.2 too. When you have KinematicCharacterMotor.cs attached to a prefab and you have it selected in the project view the editor lags like crazy. I thought it was maybe connected to the KinematicCharacterMotorEditor OnSceneGUI code but commenting it out made no difference.
     
  3. songpwc

    songpwc

    Joined:
    Nov 6, 2018
    Posts:
    14
    hi great asset. some questions.
    1.can character controller player stand on a no kinematic moving platform and move with this platform, even when this platform be collided by other rigidbody and bounce around?
    2.can this platform be any collider instead of box collider ?
     
  4. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Hey was curious if you have plans to make a Unity.Physics version of this? Understandable if not, probably not nearly enough people using Unity.Physics for that to make sense financially.

    In our game this controller is actually the only thing preventing us from ditching almost all of our Physx colliders. We actually maintain Unity.Physics and Physx colliders for most of our colliders now since most of our features use Unity.Physics..
     
  5. RiseBasti

    RiseBasti

    Joined:
    Nov 4, 2018
    Posts:
    33
    Hello everyone

    I'm using this controller since some time and I enjoy using it but now I'm facing a problem which I don't know how to solve.

    When my player grabs an object (lets say a cube) and he holds this cube in front of himselfe how can I...
    1. still move around with the player
    2. handle the collision with the object I'm wearing?

    Thank you very much if anyone has an idea to solve this.
     
  6. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    976
    Was looking forward to using this but seems its abandoned?
     
  7. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    331
    Developer of this asset always shows up in the end :D And does amazing job.
    I bought this character controller recently and I have to say - it's the best stuff you can get ATM. Period...
    Clean code, insanely customizable, well documented. Also it's not something I would expect to break much with Unity updates.

    I guess the dev is just too busy scaling dem mountains. Can't say I blame him. I envy him :D
     
  8. pal_trefall

    pal_trefall

    Joined:
    Feb 5, 2019
    Posts:
    78
    He is probably/hopefully working away on a DOTS version of KCC and must not be disturbed :cool:
     
    Vincent454 likes this.
  9. Sanyol

    Sanyol

    Joined:
    Jan 28, 2013
    Posts:
    24
    I agree that this plugin is really great, but for us, it has a collision problem that won't allow us to use it. Not responding to the customers for more than 4 months is really bad.
     
    Vincent454 and mrCharli3 like this.
  10. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Can anyone explain to me the step up logic used in this asset, the code is so it's very difficult to isolate that code but I purchased for that bit only, please help
     
  11. rmorph

    rmorph

    Joined:
    Apr 3, 2012
    Posts:
    87
    Is this asset abandoned?
     
    Ruchir likes this.
  12. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    331
    Did you try to reach him by e-mail as well? I saw people here saying he responds to e-mails no problem.
     
  13. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    976
    benn over a week with no response on email...
     
  14. Sanyol

    Sanyol

    Joined:
    Jan 28, 2013
    Posts:
    24
    Of course, unfortunately without any luck.
     
  15. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    331
    Over a week is nothing huge. It is important to consider that asset store assets are usually being developed by a single guy. And that one guy just has to go on a vacation sometimes. Some people may take a month or two month vacation.

    I think in such cases the developer should be open about it and post here in the forum thread that he will not be available for a longer period of time. On the other hand, one might forget to do that. Again, it's just a single guy after all.

    He just might be on a 2 week vacation. Or has to take a break from the asset for some time. Or is working on a huge update and prefers not to be distracted by support - since doing support could very well prevent him from implementing that cool new feature altogether.

    Worst case scenario - something happened to him. And I doubt his grandma/mom/wife's top priority would be to immediately jump here to clarify. I hope that's not the case though, not just for the assets sake, but for his. He seems like a cool guy, just look at his photo. Just chillin' there, in the snow, surrounded by mountains :D

    Just wait a bit longer. I believe he will let us know shortly.
     
    Vincent454 and owen_proto like this.
  16. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    976
    You are prob right, and hopefully its nothing bad. But usually if you go on vacation or similiar you leave an automatic response on you email. Either way, not much to do except wait, wont buy the asset until its confirmed that its not abandoned :)
     
  17. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    I'm pretty happy with this even with zero support. It has some great coding in it and is the best solution I've seen for a kinematic controller. The code is very clear on what's going on and with little bloat so I've been able to modify it to deal with any issues I've encountered and integrate it into my game. It is very much a coder's asset that can save you a ton of time/money but isn't for visual scripters or whatever.
     
  18. maxxa05

    maxxa05

    Joined:
    Nov 17, 2012
    Posts:
    186
    I wrote by DM to the dev 1-2 months ago, but got no answer. At this point, I had the asset already and I'm willing to maintain it myself since it's so much better than any other character controller out there, but be aware that it does seem to be no longer supported by the dev.
     
  19. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    714
    We are using the Kinematic Character Controller extensively here too, with no major issue, and I just saw this post from @PhilSA in the DOTS forums.

    Is a new DOTS and Unity Physics controller on the way? And if yes, is there any estimated time of arrival?
     
    andreiagmu and Gooren like this.
  20. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    331
    And here comes the "I told you so" moment :D Nothing is abandoned. On the contrary, we're about to get a new product/update that will be even better.

    Praise Phil!
     
    Last edited: Oct 18, 2019
  21. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    976
    Cool that he is upgrading, bit still important for ppl to know that if you get this asset you should not expect to get any support.
     
  22. rmorph

    rmorph

    Joined:
    Apr 3, 2012
    Posts:
    87
    This dev is actively scanning the forums - in fact was online 10 minutes ago - so he is purposefully ignoring this thread.

    This is absolutely disgusting behaviour.
     
  23. Petethegoat

    Petethegoat

    Joined:
    Jun 12, 2013
    Posts:
    39
    Chill out on the "absolutely disgusting".
    It costs $60, that's not going to cover many hours of customer service.

    The store page warns that strong programming knowledge is required, and I don't see any promises of developer support.
     
    OdderOtter, hippocoder and Gooren like this.
  24. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    331
    Exactly. Rmorph's behavior can only discourage the dev from working on the asset at all. It seems Phil is porting the asset to DOTS. Now that would be amazing!
    If that is the case, supporting the current version would be almost meaningless. One individual either supports current version or works on overhauling the thing from the ground up.
    This is an Asset Store asset. He can do whatever he wants. Asset Store devs are mostly individuals. Make him mad and he just might abandon the asset altogether. Devs are not getting rich from the AS. It is usually more about the passion and willingness to share than anything else. Unless you are Odin developer or one of the other few lucky.

    Phil clearly states from the beginning that this asset is meant for battle hardened programmers. If you listened to this advice, you should be able to fix/workaround most of the issue you might encounter. Furthermore, this asset is pretty stable.

    I think it would be fair from Phil to post here what's happening so we don't have to speculate all the time. On the other hand I understand how he could feel about it. I know that when I check my asset's forum thread and read what people write, I have to react immediately. I can't get it out of my head. Now that is a problem when you want to do something else but support.
     
  25. RiseBasti

    RiseBasti

    Joined:
    Nov 4, 2018
    Posts:
    33
    Hey everyone

    I know Phil is minding his own business atm but i think some of you can help me with a question I have.

    I just realized that the capsule dimensions in the motor are private but there's a "SetCapsuleDimensions" function and now I'm confused why it should be possible to set but not get the dimensions.
    Is there a reason why or can I just make a function like:
    Code (CSharp):
    1. public (float CapsuleRadius, float CapsuleHeight, float CapsuleYOffset) GetCapsuleDimensions()
    2.         {
    3.             return (CapsuleRadius, CapsuleHeight, CapsuleYOffset);
    4.         }
    But at this point I wondering why the variable is private because at the end it's the same as if it would be public... or not?

    Thank you for your Help!
     
  26. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    331
    @RiseBasti If it's just a variable, then he made it private for encapsulation sake. Setter method made sense. And maybe it simply didn't occur to him to make a getter method/property. There is pretty much never a reason to not add a getter when there is a setter already.
    If a getter is missing while setter exists, it's simply because no one bothered to add it. So feel free to add it yourself and hope Phil will add it in the next update, so that you don't have to merge it all the time.
     
  27. RiseBasti

    RiseBasti

    Joined:
    Nov 4, 2018
    Posts:
    33
    @Gooren Thank you for the input.
    It's nice to know I don't mess anything up I just don't understand.
     
  28. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    @RiseBasti why can't you refer to the Capsule dimensions directly? KinematicCharacterMotor.Capsule.radius, KinematicCharacterMotor.Capsule.height, KinematicCharacterMotor.Capsule.center.y (x and z are always 0). Capsule is public, and the properties are updated when you call SetCapsuleDimensions (although the height is clamped to 2* the radius in the actual Character Controller).
     
  29. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Hello everyone: I need my character to have Rigidbody component so that it can interact with other Physics objects in the scene, notably pressure plate that requires a Rigidbody with a mass to press it (it returns back to original position by Spring Joint). Is this problematic with KKC? Thing is this Rigidbody needs to have "use gravity" enabled so that it actually "press" the plate. (I am aware about OnTriggerEnter/Exit solutions but that is not the gameplay requirement).
     
  30. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    165
    I just tried it out, as my character needs an additional rigidbody too, but it bugged out by spinning and flying around with gravity enabled, however if you find a different solution without gravity, it works just fine with a kinematic one.
     
  31. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    In Physx and general physics engines, the mass is not what's causing this but the applied downforce or gravity. So if you were using KCC you would want to register a collision then apply the same force to the collision point. This will require you know how to code, but other than this it's possible.

    To simulate if this works for your needs, do it with a raycast hitting the spring switch, applying the relevant downforce. As you are probably aware, a single raycast is the exact same amount of contact a capsule collider has on a surface as well - that is, there's only ever one point for a sphere. So you can probably test it outside of KCC.

    It's been a while since I used KCC but I know it has the functionality for general purpose detection.

    Why do you need KCC?
     
  32. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Yeah if you want the controller to be driven by physics then it isn't Kinematic so you'd want to use a different controller. If you want controlled contact between your KCC and a rigidbody then use the collision detection in KCC (OnMovementHit) to throw force at the other RB. If you want the KCC to be hit then add it as an external force in
    UpdateVelocity.
     
  33. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    That is very valuable information, thank you. To clarify: I should be casting a ray downwards and ad a force to the detected collider below (if it has Rigidbody), correct?

    As a character controller :) Not sure what specifically you are asking about but I am working on a adventure / platformer game and KCC proved very useful to quickly prototype. Challenge is, the game will have physics-based puzzles.
     
    hippocoder likes this.
  34. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    That is indeed the case and I will dig into the suggestion, thanks :)
     
  35. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Interesting part for me is that even tho gravity / jumping is implemented using KCC in my character, adding a Rigidbody with gravity enabled doesn't seem to change anything at all in character movement except it makes my pressure plate work. I suspect Kinematic Character Motor overrides what Rigidbody does during the physics update
     
  36. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yep just you want a hit.point then you just https://docs.unity3d.com/ScriptReference/Rigidbody.AddForceAtPosition.html and that's it. It's that trivial. Of course with KCC you will have this information without needing to raycast: when the KCC touches it, it gives you a whole bunch of info back about it.

    Just apply the force there, of your choice. You may experience jittering or the likes which is just a timing issue, and if that happens we can just tell it to do the force elsewhere in the code. Sorry for being vague.

    I wrote my own rigidbody character controller and bought KCC to compare notes basically. Mine temporally fixes itself for slopes and uses just a rigidbody with nothing else. Great stuff but relies on using either compute penetration command or in newer versions of Unity, OnCollisionStay (which is no longer evil in newer versions of Unity with the reuse contacts option).

    Despite all of that, I'm back using the built in Character Controller for a bit because ultimately all of this is just not necessary except maybe for polish.... benefit of experience I guess. Plus I'm going to port to DOTS at some point and that uses Unity's new physics engine, so I figured I keep things pretty simple at the moment.

    That's not to say KCC isn't good (it's great). Just peripheral info / waffle.
     
  37. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    165
    I should have added that it only bugged out when stepping on another non kinematic rigidbody. No idea why though
     
  38. Ph3n0m

    Ph3n0m

    Joined:
    Sep 11, 2017
    Posts:
    2
    Go to KinematicCharacterMotor.cs - line 546. Comment out
    Code (CSharp):
    1. Capsule.isTrigger = false;
    That will fix the editor lag issue, but obviously whole OnValidate method needs rewriting to be more efficent.

    @FcsVorfeed @Silly_Rollo
     
    Salveiro, LezCT and Gooren like this.
  39. FcsVorfeed

    FcsVorfeed

    Joined:
    Aug 15, 2014
    Posts:
    50
    unbelieveable ! it works! thanks very much!
    here is my modification method
    QQ截图20191116022557.png
     
  40. Monil

    Monil

    Joined:
    Apr 24, 2012
    Posts:
    102
    Hello people,
    I'm stuck on how to walk on a big monster, I need your help, someone can give me some suggestions, with OnGroundHit I have the index of the collision triangle and the barycentric coordinates, how can I move the player on a moving surface that is deformed?

    Walk_on_deforming_surfaces_1.jpg Walk_on_deforming_surfaces_2.jpg
     
  41. florian_d

    florian_d

    Joined:
    Apr 13, 2010
    Posts:
    34
    @PhilSA regarding that in-editor "lagging" issue, I wanted to chime in to provide a bit more info.

    The issue stems from what seems to be the update to the prefab system, and the changes done in ValidateData (when called in OnValidate() )

    upload_2019-11-19_17-54-39.png

    The moment the asset is selected we're thrown in a OnValidate loop, where validation modifies the prefab, which will then trigger the SaveDirtyPrefabAsset, which will trigger OnValidate, so on and so forth. The "lag" impression comes from the constant refresh of the asset in the inspector and writing to the disk.

    I'm currently running with the OnValidate commented out (as ValidateData() is called anyway in both Reset and Awake, which I hope is enough regarding the data setup and validation).
    Since it's an EditorOnly callback, it's not a massive issue, but is still an inconvenience.

    Cheers.
     
    andreiagmu and LezCT like this.
  42. LezCT

    LezCT

    Joined:
    Nov 15, 2014
    Posts:
    55
    Thank you @fderudder @Ph3n0m for finally looking into this, it's breaking and worse, corrupting prefab asset files since the new prefab workflow was rolled out, and KCC hasn't updated with this fix since.
     
  43. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    331
    Hi, what is the best way of transferring NavMeshAgent desiredVelocity to AI's KCC for NPC movement please?
    Thanks
     
    Last edited: Nov 21, 2019
  44. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Okay everyone, time for a very shameful update after hiding for a few months:

    I'll be releasing an update soon
    The update will be tested on 2019.2 and will contain the following:
    • fix editor lag/crash when selecting a character prefab
    • fix ladder example
    • fixed slowing down when moving in air against a corner¸
    • fixed "Kinematic" physics interaction option that didn't affect rigidbodies anymore
    • PhysicsMovers now contains "PositionDeltaFromInterpolation" and "RotationDeltaFromInterpolation", which tell you every render frame how much the mover has moved since last frame. Use this to rotate a camera along with a moving platform you're standing on
    • KinematicCharacterSystem.Simulate() now only needs lists of characters and movers. No more Arrays + counts
    • KinematicCharacterSystem now has a "KCCSettings" field, which is a scriptableObject. So if you want, you can create a KCCSettings asset, edit these settings in inspector, and assign it to the KCSystem on start

      You can still mod these settings at runtime via script like this: "KinematicCharacterSystem.Settings.Interpolate = false"
    • Air movement fixes/improvements (velocity cap, strafing, etc...)
    • PhysicsMovers now have a "MoveWithPhysics" option, which determines if they move with rigidbody.position or rigidbody.MovePosition. When true, it'll apply friction to rigidbodies on it. When false, it won't.
    All of this is presently ready. I just have to test it and submit


    Why I've been away
    1. Very busy with work / personal life. I don't have as much free time as I used to
    2. Support for this asset can be very very tough. A large portion of "how do I implement X" questions require me to implement an entire game mechanic before I can answer, and sometimes it is simply too overwhelming. Character Controller-related features often have so many intricacies with interpolation/update order that I can't even imagine answering a question without literally sending an entire example project with the feature already implemented by me, and just saying "look at that code"
    The thought of making it free did cross my mind, but making it free also means that I would have zero reasons to make updates like this one when problems happen. So in the end, I decided not to


    What's next
    I've been very invested in DOTS lately, and I very much intend to create a DOTS character controller. The funny thing is: It may not even be fully "kinematic" anymore. DOTS physics gives you such an unbelievable amount of control that I think I can make a CC that has the exact same movement quality as KCC, but that can also react naturally to rigidbodies without any hacks. It's still something that I'm researching, though, so I can't make any promises. And I doubt it'll be released until Unity declares that DOTS is officially released

    There are things I do not like about KCC. I'm satisfied with the results it gives you, but I'm not satisfied with the "user experience" and intuitiveness side of it. It can be very complex to work with it, and there are tons of things you need to know. Some of it is due to the fact that I can't completely change the architecture of a live asset (I'm stuck with the architecture I chose years ago, when I was young and foolish), and some of it is due to the fact that the monobehaviour workflow and PhysX integration simply do not give you enough control to make something elegant and clean (that's why I ended up doing a KinematicCharacterSystem, which is kind of a pseudo-ECS just for KCC and moving platforms). I believe DOTS CC will solve both of these problems: a fresh start, and incredible control over the physics simulation.
     
    Last edited: Nov 25, 2019
  45. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    331
    Oh please don't make this free! I understand support for this asset must be terribly time consuming and making it free would inevitably lead to bugs that won't be fixed. And next to no one will be able to fix, since character controller is something entirely different than say... custom UI elements...

    This update just made my day. Can't wait for it to hit the store :)

    Have a nice day!
     
  46. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    165
    This is awesome, thank you so much for the update! This is the best character controller Ive ever used and I could not be more happy with it.

    If you ever finish the DOTS version, I wouldn't mind paying again as its a lot more than the original asset when I bought it promised!
     
    Gooren likes this.
  47. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    331
    I second that!
     
    alexandre-fiset likes this.
  48. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    714
    I second that as well and would pay much, much more for it if that gives you more resources to justify the time and effort spent into making it.
     
  49. Shturmovik

    Shturmovik

    Joined:
    Nov 5, 2014
    Posts:
    29
    Huge sighs of relief!

    Don't wait for perfection, just get that updated version live - and I too would be happy to pay for a DOTS version when it's available.
     
  50. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    KCC 3.2.0 is submitted for review. Expect it to land on the store in a few days

    EDIT: it's there now
     
    Last edited: Nov 26, 2019