Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

[RELEASED] Scivolo Character Controller

Discussion in 'Assets and Asset Store' started by MenteBacata, Mar 17, 2021.

  1. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49


    Scivolo Character Controller is a set of components that provides the basic functionality for creating a custom character controller. It is proposed as an alternative to Unity's built in CharacterController component also expanding its functionality, for example it allows to freely rotate around any axis.

    It has been made with kinematic movement in mind so for situation where the character is not meant to behave or move like an actual physical body.

    Each component doesn't hold any movement logic, this is to allow great flexibility in many different scenarios, still trying to fulfill the common tasks that every character controller should accomplish.

    On the asset store for FREE.

    Online Demos
    Simple Character Controller
    Viking Village Third Person Character Controller

    Update Posts
    Version 3.0.0

     
    Last edited: Sep 12, 2023
    hippocoder, MaximKom and Fibonaccov like this.
  2. arrcwood

    arrcwood

    Joined:
    Sep 4, 2019
    Posts:
    4
    Hi, I've downloaded your asset and have entered the Demo Level. But when I click play, the character falls through the floor. Am I supposed to add anything to the character in the demo level? Also, many of the objects are missing a script according to the Inspector. I'm using Unity 2020.3.7f1.
     
  3. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    The demo scene should work straight away, if you have imported the asset into an existing project check the collision matrix in the physics tab in project settings and make sure that the default layer can collide with itself. Those missing scripts are just probuilder scripts of the level models, you can ignore them.
     
  4. FloweryAF

    FloweryAF

    Joined:
    Sep 13, 2020
    Posts:
    13
    Hi! Thanks for making such a great character controller. I've been using it for a while now and I love it.
    For a new project I'm struggling to get my head around Root Motion. Can this controller be used in conjunction with Root Motion? Or are they incompatible?
    Thanks again, sorry to ask such a basic question.
     
  5. FloweryAF

    FloweryAF

    Joined:
    Sep 13, 2020
    Posts:
    13
    Woah! You released a new version today! Congrats!
     
  6. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi, glad you like my asset.
    To use root motion you have to get the movement from the Animator and pass it to the Move method, for example:

    Code (CSharp):
    1. void OnAnimatorMove()
    2. {
    3.     characterMover.Move(animator.deltaPosition, contacts);
    4. }
     
  7. FloweryAF

    FloweryAF

    Joined:
    Sep 13, 2020
    Posts:
    13
    Thank you so much!
     
  8. abhi3188

    abhi3188

    Joined:
    Dec 13, 2015
    Posts:
    31
    Hi, thanks for creating this asset! It looks really great!

    I have two questions:

    1. The controller seems to have some issues with vertically moving platforms with the grounded check getting confused and also not sticking to the platform when it descends. I tried adjusting the ground tolerance amount but that doesn't help either. Any way around this?
    2. Is it possible to push a rigidbody using this controller? Similar to how Unity's built in character controller has OnControllerColliderHit (link). Is there any callback to know what it hit.



    Thanks!
     
  9. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi,
    For the platform problem, I need some time to check a little deeper, I'll let you know when I've found a solution.
    To push rigidbodies you can use the moveContacts list to retrieve all the contacts that the move method detected, you can analyze them one by one in a for loop and apply force if they have a rigidbody attached.
     
    abhi3188 likes this.
  10. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    I actually noticed a problem that affects the correct functioning of the ground detection when the platform moves vertically, but it was not enough to explain the behavior in the video. The other problem is that physics auto simulation is expected to be false, while it is active by default in unity and this makes the situation even worse. My fault for not thinking about it before, but at least I managed to reproduce the problem in the video.
    I will fix these bugs in the next version, along with some updates.
     
  11. abhi3188

    abhi3188

    Joined:
    Dec 13, 2015
    Posts:
    31
    great, thanks. Any idea when this update will be coming out?
     
  12. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Soon, probably by next week I will upload to the store.
     
  13. abhi3188

    abhi3188

    Joined:
    Dec 13, 2015
    Posts:
    31
    Any chance I can get access to it before it goes through the long store approval process? I can email you a copy of the purchase receipt.
     
  14. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    I will also upload the new version here in this thread when it is ready. It's free anyway.
     
  15. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Here is the new version.
    Now the CharacterCapsule component takes care of resolving the overlaps with the other colliders, if it is enabled it does it automatically at each update, but it can also be done manually by calling the TryResolveOverlap method.
    I also added the ability to specify which layers to prioritize when resolving the overlaps in case it fails to resolve them all.
     

    Attached Files:

    abhi3188 and MaximKom like this.
  16. abhi3188

    abhi3188

    Joined:
    Dec 13, 2015
    Posts:
    31
    great, thanks so much!
     
  17. jzaun

    jzaun

    Joined:
    Feb 20, 2010
    Posts:
    26
    I love the controller, its everything I've been looking for. Would you consider putting this in a GitHub repo?
     
  18. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi, I'm glad you like it. It's actually already in a private github repo, but it's full of debug code which I then clean up before release. So for now I prefer not to show it in that state.
     
  19. Jroel

    Jroel

    Joined:
    Oct 25, 2013
    Posts:
    14
    Good morning.
    I am still running into the issue described by abhi3188 on Aug 15, 2021.
    MyCharacter seems to "bounce" as the platforms descend.
    Oddly enough, the bouncing does not happen in the demo scene.
    It only happens in my own custom scenes.

    I have tried adjusting the settings. I cannot figure out what I'm missing.
    I would appreciate any help or ideas as what could be causing this.


    I did just notice one more thing.

    When I change the rotation of the demo level, I now fall through the floor. Maybe something I changed is effecting the ground collision. I am using the stock SimpleCharacterController with modified jumping functionality. The remaining is what you provide in the asset.
     
    Last edited: Nov 25, 2021
  20. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    If you can send me a project where the problem can be reproduced, I will take a look.
     
  21. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    I have come up with a possible cause for this issue. Make sure there is a game object in your scene with the TransformsSyncher component attached.
     
    Jroel likes this.
  22. Jroel

    Jroel

    Joined:
    Oct 25, 2013
    Posts:
    14
    That's awesome. That solved it!
    I knew I was missing something!

    Thank you!!!!
     
  23. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Very good! In fact that component is a bit hidden, it would be better if you put it on a separate game object.
     
    Jroel likes this.
  24. rymcc

    rymcc

    Joined:
    Mar 30, 2020
    Posts:
    5
    Hello, I am trying to create an FPS controller that allows crouch. I alter the controller's height via Height property of the CharacterCapsule component, however I have noticed that this prevents my controller from climbing up stairs that it would normally do via standing. Altering the max step height value of the CharacterMover component doesn't seem to help, is there some other value I should be looking into? Thanks!
     
  25. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    It's probably a bug, I can't check now, I'll let you know in the next few days.
     
  26. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    I can't seem to reproduce the issue, can you show me how you implemented crouch?
     
  27. rymcc

    rymcc

    Joined:
    Mar 30, 2020
    Posts:
    5
    Ah I've found what causes my issue, my problem was I was trying to set my controller's height to less than or equal twice the capsule's radius. My capsule's radius was 0.5, I was setting the height to 1. Setting the height to 1.01 or above makes it work perfectly. My mistake, thanks for your time!
     
  28. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Actually it should work even in that case, I've just tried setting the height to 1 with a radius of 0.5 and it works just fine for me.
     
  29. rymcc

    rymcc

    Joined:
    Mar 30, 2020
    Posts:
    5
    Odd, if I set the height to 1 with radius 0.5 my controller can't move up or down steps that it's able to when the height is set higher. Probably some code in my character controller affecting something somehow. In any case its working fine for me now but I'll poke around in my code.
     
  30. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    If you want, you could send me a small project where I can reproduce the problem, I'm curious to find out the cause.
     
  31. rymcc

    rymcc

    Joined:
    Mar 30, 2020
    Posts:
    5
    Just took the time setting up a project and it works without issue lol...I stripped out some stuff from my character controller like inventory, footstep sounds, etc, but none of it interfaced with your components.
     
  32. rymcc

    rymcc

    Joined:
    Mar 30, 2020
    Posts:
    5
    After messing around further, it seems it has to do with whether the object has a mesh collider. It works fine if its a simple box collider though. I'll pm you a project demonstrating.
     
  33. FloweryAF

    FloweryAF

    Joined:
    Sep 13, 2020
    Posts:
    13
    Hi MenteBacata, is it possible to use the step/slope/ground detection to stop the player being able to step off cliffs? (I'm trying to avoid having to make a lot of very detailed colliders).

    As usual, thank for making such a versatile and helpful controller!
     
  34. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi, unfortunately it doesn't support that feature out of the box.
     
  35. FloweryAF

    FloweryAF

    Joined:
    Sep 13, 2020
    Posts:
    13
    Good to know, thank you for replying!
     
  36. Boolable

    Boolable

    Joined:
    Jun 28, 2015
    Posts:
    20
    Very nice job @MenteBacata !
    I have a few questions:
    1. What kind of licence applies to your asset? Are we allowed to improve it (for example, I'm planning to add crouch feature and wall jump to you code, can I do it and use it in my game?).
    2. If we are allowed to modify (improve) your code, how can we share thoses improvments (I don't want to put your code on Github be myself, I would feel like a thief ^^).
    3. I see you use GameObject position to move the character. In some forums, peoples says that rigidbody should be moved only using rigidbody's methods (MovePosition or changing velocity for exemple). But most character controllers on Unity Assets Store uses GameObject position just like you. Can you explain me why? (I've tried to develop my own character controller using rigidbody + rigidbody methods for movement, but I cannot find a way to manage moving platforms properly, I guess this is one of the reasons).
    Thanks for you asset, verry helpfull !

    Ben
     
  37. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi, thank you!

    There are no particular restrictions to the use of the asset. However I suggest modifying only the scripts in the Demo folder which I actually don't consider part of the assets itself but just an example to show the asset functionality. You are still free to edit the other scripts, but that could cause issues with future releases. If you want you can share your code here.
    It's actually already on a private repository on github, but the code is cluttered with debug stuff and that is holding me from making it public.
    The rigidbody has its isKinematic field set to true and that is made especially for moving the game object by changing transform.position. From what I've read, it should not be necessary anymore, but in older Unity versions moving a game object without a rigidbody attached was bad for performance.
    The main issue is that changing transform.position in FixedUpdate will break rigidbody interpolation if enabled, so for now its use it’s limited in Update. I have already implemented a simple solution for this, but I want to test it thoroughly before releasing it.
     
  38. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    302
    Just to clarify is your controller a kinematic character controller or rigidbody character controller?
     
  39. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    It's kinematic, in the sense that it doesn't use unity physics to move. It uses casts to calculate the movement and applies the new position directly to the transform.
     
    giraffe1 likes this.
  40. AdrielCodeops

    AdrielCodeops

    Joined:
    Jul 25, 2017
    Posts:
    54
    Hi, awesome asset, very well programmed. I've been doing some experiments and found that Physics.IgnoreCollision doesn't work even passing as an argument the capsule collider. Is it be possible to make scivolo works with Physics.IgnoreCollision?

    Thanks for this amazing work!
     
  41. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi, thanks.
    I am considering implementing IgnoreCollision support.
    For now, If you want scivolo to move through certain colliders you could put them in a separate layer that is set to not collide with the layer in which scivolo is. But this way collisions will also be ignored when the colliders move into scivolo.
    Instead, if you just want the scivolo capsule to be ignored while doing some collision tests, you can temporarily set the capsule isTrigger field to true.
     
  42. AdrielCodeops

    AdrielCodeops

    Joined:
    Jul 25, 2017
    Posts:
    54
    I am making a multiplayer game where players can pick up objects and throw them. When they throw them, I have to filter the collision between the throwable object, and the player who throws it. The problem is that I have to process all the collisions on the server... So with layers I would have to do something like this: When a player catches an object, the player passes to another layer that cannot collide with that object, but with all the others caught (and thrown) by other players. I also have NPC that turns into player allies, and i have to filter them too on throw. Maybe I'm thinking about it the wrong way, but I think I would need a large number of layers and these are limited.

    Maybe is not the best asset for my purpose, but i really love how it feels! Would be cool to make it work in a reasonable way.
     
  43. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    You could turn the colliders to ignore to trigger right before moving the character, and then turn them back to normal right after. Each character could have a list of colliders to ignore. I think it should work similar to IgnoreCollision.
    If overlap resolution gets in the way, you can still disable the CharacterCapsule component and manually call TryResolveOverlap.
     
  44. Boolable

    Boolable

    Joined:
    Jun 28, 2015
    Posts:
    20
    Hi @MenteBacata
    I'm making a multiplayer game to (with your character controller). On my game, a player can move to a certain point while pressing a key (something like a dock for your character. You are close to dock, you press docking key, the player moves in the center of the dock to be docked). Some time, another player can stand in the dock, so when you player press the key to go to the dock, the one already on the dock should be pushed away. It work out of the box but only for one player.
    It's hard to explain, so I made a short video:


    As you can see, when I try to push others players with the player in the left, the other players doesn't moves.
    When I try to push others players with the player in the middle, only player from left moves.
    When I try to push others players with the player in the right, both others players moves.

    I there a way to have the same behaviour than moving with player in the right for every players?
     
  45. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi,
    It seems like overlap resolution is executed in order from left to right. So when the character which moves resolves overlap for first it gets pushed away and the other stays still, and vice versa.
    If you could keep track of which players are currently in the dock you could disable their CharacterCapsule component and manually call the TryResolveOverlap method starting from the ones already in the dock and the one moving for last.
     
  46. Voltagami

    Voltagami

    Joined:
    Mar 13, 2021
    Posts:
    5
    Hello,
    I'm rather new with Kinematic Controllers and have only been using the built-in CharacterController Component from Unity, so the question may be basic.
    I have looked into your example script for movement and you're using the Update Method for handling movement (as well as for Input but this one is obvious). Since this controller uses a Rigidbody Component I assumed movement logic should go in FixedUpdate. Also I saw on other Kinematic Controllers that they use FixedUpdate for handling movement.
    So is FixedUpdate in fact the proper choice for your controller or Update like in your example script?
     
  47. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi,
    with kinematic rigidbody it’s mostly a personal choice whether to use fixedupdate or not, using only update it's fine and it's simpler since you have to deal with a single update function, but you can get inconsistent behavior if the framerate is not very stable, for example character can jump a bit higher when the framerate drops.
    You can use scivolo to move in fixedupdate, but since it directly assigns the transform position you can’t use rigidbody interpolation.
     
    Voltagami likes this.
  48. Voltagami

    Voltagami

    Joined:
    Mar 13, 2021
    Posts:
    5
    Just noticed something with your controller. When I try to move up a slope which has exactly the slope limit angle of the character it jitters but walking on such a slope is fine. I guess I have to just avoid having such slopes in a game then.
    Overall I'm pretty happy with this asset at the moment.

     
  49. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Yes, it's a known issue.
     
  50. Voltagami

    Voltagami

    Joined:
    Mar 13, 2021
    Posts:
    5
    Hi,
    Is there a way to get like the physical velocity of the controller? Similar to characterController.velocity where it considers collision.