Drawbacks of Moving Rigidbody by transform.translate

Hi i’m making 2d platform game.My player has a rigid body.I wrote a simple script that player can move to the left and right and jump, i used transform.translate to move and to jump; and i used OnCollisionStay,OnCollisionExit for collision states.But player doesn’t move or jump properly, player is jittering on edges or on corner of platforms.To prevent jittering and checking collision better, i add raycasts to the player object but i couldn’t obtain satisfied result yet.I’m thinking using CharacterController instead of transform.translate at now.But on the other hand there is possibility that my script has bugs.

1. What do you think about moving by transform.translate ? Can it cause collision errors?

2. Does CharacterController give a lot better result than transform.translate?(when i say better result, i mean better collision check when moving,better control of physics, flexibility when coding…)

If you are to move a rigidbody you would do that by adding forces. Translating the transform of a GameObject that has a rigidbody will result in jittery behavior. I’d suggest that you choose either way and don’t mix them together unless you alternate between a kinematic behavior.

  1. Translate is basically the same as saying transform.position += Vector3(x,y,z); It is a good and practical way of moving a transform.
  2. A CharacterController might be easier for you to start with to combine physics behavior of a non-rigidbody. You can extend the CharacterController to your liking as well. Rigidbodies are however still perfect to use in a 2d platform environment, the trick is to never alternate the transform, instead just use physics.