Collision checking - fast objects go throw other objects

razer
Posts: 82
Joined: Sun Apr 04, 2010 10:08 pm

Collision checking - fast objects go throw other objects

Post by razer »

Is it possible to set some flag to make bullet verify if there is anything between old potion and new position of rigidBody and avoid situation when fast moving body fly throw ground or wall.

Cheers
chrozz
Posts: 8
Joined: Fri Mar 12, 2010 10:21 pm

Re: Collision checking - fast objects go throw other objects

Post by chrozz »

See :
http://bulletphysics.org/mediawiki-1.5. ... _The_World
Especially the section on fixedTimeStep resolution.

What I am doing to resolve this "resolution problem" is passing a smaller fixedTimeStep to dynamicsWorld->stepSimulation().

ie:

Code: Select all

double TimeInterval = game->GetTime(); // in seconds
float frameRate=TimeInterval - lastTimeInterval;
lastTimeInterval = TimeInterval;

// where the last parameter is overloaded ( default is 1/60.f)
dynamicsWorld->stepSimulation(frameRate,steps,1/120.0f);

razer
Posts: 82
Joined: Sun Apr 04, 2010 10:08 pm

Re: Collision checking - fast objects go throw other objects

Post by razer »

Thanks but it will make my object fly 2 time faster only.

If I wish to make it really fast then I will have to implement a following hack.

When objects will move fast (one step distance larger then 20% of object size) then
class implementing btActionInterface will check check collision for next step. If it is expected to touch something in next step then something must be done.
It is not clear what exactly but I have following ideas.

1. translate object forward just near "ground or wall" (optional)
2. decrease its speed to 5-25% of object size per frame

I thought something like that was already done in bullet.

Optimal solution would be to adjust object that way that it slightly touch ground, wall next step. But I do not know how to do it simply and reliable.

I hope my solution will work

Cheers