Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Rigidbody for character movement - Kinematic vs Dynamic

Discussion in 'Game Design' started by Dokuni, Aug 17, 2022.

  1. Dokuni


    Mar 30, 2021
    Hi everyone,
    I started studying Unity a few weeks ago and, to make myself more familiar with the editor, I'm trying to reproduce the first level of Super Mario Bros.

    Currently, I'm dealing with the character movement component and I decided to implement all the horizontal and vertical movements myself using standard physics formulas (uniformly accelerated motion, etc.).
    I am struggling with the type of the rigidbody that the character should have: kinematic or dynamic.
    Since the character should not be moved by other bodies (projectiles, monsters, etc.) I decided to make it kinematic, but the problem is that the collisions with obstacles don't stop the player.
    On the other hand, if I make the body dynamic I should handle all the collisions in a way such that the player is not moved by other elements in the scene.

    To summarise my study:
    - Kinematic
    Pro: other bodies don't affect my character
    Cons: collisions don't work in the proper way
    - Dynamic
    Pro: collisions work properly and my player movement is stopped by an obstacle
    Cons: other bodies affect my character

    Am I missing some concept to make things easier? Which could be the best solution?

    Thank you in advance :)
  2. angrypenguin


    Dec 29, 2011
    Have you looked into the "Character Controller" component? It's specifically designed to cover this use case, as opposed to the physics built into a Rogodbody, which is meant to approximately simulate real physical reactions, which isn't what you want.

    Other than the Character Controller, you likely need to use a kinematic body and script the interactions you want the body to have with other colliders, which is quite a bit of work.