I would like to use Bullet Physics engine to simulate the objects in 3D world.

One of the objects in the world will move using the position from 3D mouse control. I will call it "Mouse Object" and any object in the world as "Object A"

I define the time before "mouse object" and "Object A" collide as t-1 The time "mouse object" penetrate "Object A" as t

Now there is a problem about rendering the scene because when I move the mouse very fast, "Mouse object" will reside in "Object A" before "Object A" start to move. I would like the "Mouse Object" to stop right away attach to the "Object A". Also If the "Object A" move, the "Mouse object" should move following (attach) the "Object A" without stop at the first collision take place.

This is what i did

I find the position of the "Mouse Object" at time t-1 and time t. I will name it as pos(t-1) and pos(t)

The contact time will be sometime between t-1 to t, which the time of contact I name it as t_contact, therefore the contact position (without penetration) between "Mouse object" and "Object A" will be pos(t_contact)

then I create multiple "Mouse object"s using this equation

pos[n] = pos(t-1) * C * ( pos(t) - pos(t-1) ) where 0 <= C <= 1

if I choose C = 0.1, 0.2, 0.3,0.4..... 1.0, I will get pos[n] for 10 values Then I test collision for all of these 10 "Mouse Objects" and choose the one that seperate between "no collision" and "collision".

I feel this method is super non-efficient. I am not sure the way other people find the time-of-contact or the position-of-contact when "Object A" can move.

  • \$\begingroup\$ You can define physic body of a 3D object bigger normally a simple 3D model is used, why you did not find this helpfull? Cause I am pretty sure you know about it, why just not define a big but proper size of physics body? \$\endgroup\$
    – Iman Nia
    Sep 5, 2015 at 10:02

1 Answer 1


The bullet 2.x API offers a "convexSweepTest" which is kind of doing what you have implemented: A ray cast with a shape. Although possibly more efficient. I would look into that.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .