Strange behavior with collisions in 3d (SOLVED)

I’m experiencing the following strange behavior wrt to collisions in 3d. I’m not sure it’s a bug. Sharing it in case anyone it rings any bells:

I have a test project with a long base co object and two smaller co bodies placed upon it at a small distance. No sprites attached to the gameobjects. Only collision objects. I’m running the project in ‘Debug’ and watching the outlines to observe how it goes. I’m pressing M to trigger throwing the first object onto the second. I do it by setting the linear_velocity of the first so that it slides on the base and hits the second. I switch from between 2D-3D to play with both physics back-ends.

The strange stuff

In 3D mode only, if i wait for a second or two before throwing the object, it just won’t move at all. Acts as if it rooted on the base. If i throw it right away it works as expected. Box2D also works as expected in all cases, delayed or not.

A potential hint

I recall a use case where i had a collision object placed over another (static one) supporting it. I continuously printed the position of the first. It was placed at (5,5,0) but what i printed was not exactly that but differed by a very very small value that kept changing for some iterations. After some time - no more than a second - it settled to (5,5,0) indeed.

Can’t say if this is related indeed. It introduces though the notion of delay in the behavior i got.

thoughts ?

UPDATE:
test5.zip (3.2 KB)

The project above illustrates the bug. It’s a falling object to a base instead of two sliding objects. You can still see that once the falling objects settles on the base it can’t move, whereas while falling, it can (3d mode).

Note, In 3d mode, the debug drawn objects appear as tiny pixels. Check at the bottom left side of the window.

1 Like

It might be a bug yes.
I’m not sure what is supposed to happen if you call body->setLinearVelocity() in Bullet3D, so if that’s the behavior we hav ein 2D physics, we’ll need to have a similar mechanic in the 3D case as well.

I included a test project. setLinearVelocity() (20,0,0) seems to work on an object that already moves (falls). After it settles it doesn’t :-/. Probably related to inactivity.

UPDATE:
Indeed. I used physics.wakeup() right before setting the linearVelocity(). It now works…

1 Like