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.