Oimo.js collision detection problem with the physic body


I don’t understand why my code doesn’t work.

I use the library oimo.js for my physic

What I would like :

In line 149, if there is no contact then my red cubes (class enemy) must levitate otherwise they fall on the ground and die via the “die” method

But I don’t get the expected result at all and my red cubes bounce on the ground?

Can you help me?


1 Like

NOT Solved by myself



After a few seconds, my red cubes (without collisions) fall to the ground! However, I have defined a y position in my loop function. Can you tell me why?

An example is better, if I set the gravity to -200, my objects fall immediately… and this is not what I want.

Could you help me to fix that ?