Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Make rigidbody controller feel like character controller

Discussion in 'Physics' started by imadrr, Mar 15, 2018.

  1. imadrr

    imadrr

    Joined:
    Dec 13, 2013
    Posts:
    20
    Hi,

    Is there any way to make a rigidbody character controller less slippery/not jumping on hitting slope, and make it stay grounded just like a normal character controller ?
    I need to use a rigidbody controller because I need it to rotate at some point, which is not possible with a character controller
     
  2. StickyHoneybuns

    StickyHoneybuns

    Joined:
    Jan 16, 2018
    Posts:
    207
  3. mathiasj

    mathiasj

    Joined:
    Nov 3, 2015
    Posts:
    64
    What exactly do you mean by that?
     
  4. imadrr

    imadrr

    Joined:
    Dec 13, 2013
    Posts:
    20
  5. mathiasj

    mathiasj

    Joined:
    Nov 3, 2015
    Posts:
    64
    If you just want a CharacterController with the functionality to rotate the underlying model, you can just create an Empty GameObject to which you attach the CharacterController and add your model as a child. Then you can rotate the child however you want without rotating the character controller.

    Of course, if you want to do something differently or need some properties of the RigidBodyController you have to go with that, but from what you have explained so far, it rather sound like you were trying to use a RigidBodyController for something that a normal CharacterController is perfectly capable to do.
     
    StickyHoneybuns likes this.
  6. StickyHoneybuns

    StickyHoneybuns

    Joined:
    Jan 16, 2018
    Posts:
    207
    Yes, they are setting rigidbody.velocity directly in that script. I have never tried that script I'm just hoping it solves your issue.
     
  7. imadrr

    imadrr

    Joined:
    Dec 13, 2013
    Posts:
    20
    Putting the CharacterController inside an empty game object seems to work, but there are still some problems.
    I want to make a gravity reverse mechanic and making the character rotate when the gravity is reversed, doesn't work well with the standard CharacterController
     
  8. mathiasj

    mathiasj

    Joined:
    Nov 3, 2015
    Posts:
    64
    What problems are there? You can rotate the model with the empty GameObject and then all that is left to do is applying gravity in the +y direction.
     
  9. imadrr

    imadrr

    Joined:
    Dec 13, 2013
    Posts:
    20
    Hey you're right, I think the problem I had was with the standard asset fps controller, not the character controller component iteself
    Like the controller wasn't immediately affect by Physics.gravity change and rotation was buggy. I'm going to try it again thanks
     
  10. imadrr

    imadrr

    Joined:
    Dec 13, 2013
    Posts:
    20
    Is there a way to make a parent object follow it's child position ? Since i'm moving the character controller object and i'm using it's parent to rotate it, I need the parent and the child objects to be in the same position

    I just read your post again, I WANT to rotate the character controller and i'm not using any model.
    At some point, I want my character object (with it's character controller component) to do a 180 degrees rotation in the Y axis, simulating a gravity inverting effect
     
  11. mathiasj

    mathiasj

    Joined:
    Nov 3, 2015
    Posts:
    64
    If you don't have a model, then I think you don't need an empty GameObject at all. I am not entirely sure, but I don't think it is a good idea to rotate the CharacterController - this will probably mess some things up since it wasn't designed for that.
    What I am suggesting is that you keep the CharacterController in its normal rotation and only rotate the underlying model, camera, or whatever your visual representation of the character is. Then you can use your not-rotated CharacterController to move; you only have to be careful to move it in the right direction (for example applying gravity in the +y direction).
     
unityunity