Search Unity

How to make things Unity Character Controller player steps on move according to physics?

Discussion in 'Physics' started by ml785, Jul 5, 2021.

  1. ml785

    ml785

    Joined:
    Dec 20, 2018
    Posts:
    119
    For instance, if my Unity Character Controller player crosses a rope bridge like this,

    then how would you make the planks of the bridge move under the player's feet?
    If you just put a Sphere with Rigidbody then the planks move automatically, but since my Player doesn't have a Rigidbody then I'm not sure how to achieve this?
    Thanks.
     
  2. Epsilon_Delta

    Epsilon_Delta

    Joined:
    Mar 14, 2018
    Posts:
    258
    You would have to create your own logic of this or somehow fake it with additional gameobject with kinematic rigidbody and capsule collider following your player...
    Obscure solutions aside, I would recommend not to use CharacterController component if you want to have complex physics interactions. Just use a rigidbody controller, you can create your own or scrape some on the internet. There was one provided by Unity even but I can't find it any more on their site, but Brackeys used it in this tutorial:

    and here's the rigidbody controller:
    https://github.com/Brackeys/NavMesh-Tutorial/tree/master/NavMesh Example Project/Assets/Example05 - LowMan/LowMan/Scripts
     
    ml785 likes this.