Physics Collision with non dynamic types

I have a “Character” object with a Rigidbody2D and a BoxCollider2D. The Rigidbody2D is set to kinematic, and I’m moving it using linear movement, which works fine. However, the “Character” object doesn’t collide with other objects that have a Rigidbody2D and a Collider2D attached.

I’ve tried changing the type (static/kinematic/animated) of the other objects, but collision detection still doesn’t work. The only time collision is detected is when I set the “Character” object’s Rigidbody2D type to “dynamic”. However, this causes the “Character” object to be affected by gravity, which I don’t want.

This is the line of code I’m using to move the Character.

const movement = new Vec2(x,y)
      .normalize()
      .multiplyScalar(this.speed);
    this.rigidBody.linearVelocity = movement;

In the attachment, you will find my objects setup.



I’m looking for some guidance or advice on how to achieve collision detection between a kinematic Rigidbody2D and other objects without enabling gravity on the “Character” object.

1 Like

Hi, i have the same problem now…

Since “dynamic” works for you, why don’t you just turn off the gravity for the character (gravity scale: 0) ?

I’m mainly of the idea that if something works, doesn’t mean it’s the best approach. I am using that currently, but I would have been happier understanding why I can’t use the other approach.

I agreed with you on that. In that case you need to do more reading.

Here is a good read regarding Rigidbody Types.

I did all the reading. I think it’s just not working.

Have you checked EnabledContactListener