Since working on the physics for the ships of our game Pulsedrive I've always had this issue bogging me.
I'm not working with bullet for a long time yet, so I probably don't know if I just have done something stupid in the setup of the engine.
Also I already asked this on the BulletPhysicsforums last month, but haven't got an answer yet.
To get you a better overview of the situation I made a little picture:
Most of the time the ship will just crash through the border marked with the red arrow when I am "fast" enough. This will also happen if I jump off a ramp and do a hard landing afterwards. I will just smash through the ground.
Ship uses a btBoxShape, track-pieces are btBvhTriangleMeshShapes. From my tests it doesn't seem that the ship crashes through a static box shape, so the problem must be the btBvhTriangleMeshShape.
Anyone knows a solution to this?
[Bullet]Fast objects crashing through my level bounds
I don't think that my objects are so fast that tunneling is the issue.
My ship would have to move about 8 units (Length of the ship) per frame for this to happen,
yet, thread were the physics are in, runs at an avg. of 0.02ms, which should be fast enough, but that happens even if I'm
moving it with just 80 or 90 units per second (80*0.02 = 1.6, problem?) , sometimes even when moving slower.
Apart from that the ship doesn't really goes through the wall fully. It gets stuck on the half way most of the times. Probably it only goes through the first polygon-wall and then gets stopped by the backside of the trackmesh.
My ship would have to move about 8 units (Length of the ship) per frame for this to happen,
yet, thread were the physics are in, runs at an avg. of 0.02ms, which should be fast enough, but that happens even if I'm
moving it with just 80 or 90 units per second (80*0.02 = 1.6, problem?) , sometimes even when moving slower.
Apart from that the ship doesn't really goes through the wall fully. It gets stuck on the half way most of the times. Probably it only goes through the first polygon-wall and then gets stopped by the backside of the trackmesh.
Meh, I forgot to press the "Post" Button yesterday, or my posting got lost, or whatever.
But I don't think that tunneling is the issue. The Thread where the physics-calculations run it, runs at 0.02ms per frame. Yet my Ship is only moving about 70 units per second.
Not enough speed to pass the whole collisionmesh in one frame.
Also it seems that the ship goes only through one side of the track and then hangs inside it because it gets blocked by the backside of the track.
But I don't think that tunneling is the issue. The Thread where the physics-calculations run it, runs at 0.02ms per frame. Yet my Ship is only moving about 70 units per second.
Not enough speed to pass the whole collisionmesh in one frame.
Also it seems that the ship goes only through one side of the track and then hangs inside it because it gets blocked by the backside of the track.
I was performing some search and found this thread.
Perhaps I'm going to ask you a trivial thing but...
Perhaps I'm going to ask you a trivial thing but...
- Is the ship a kinematic body?
- If yes, have you disabled deactivation?
- Are you using the provided "car simulation" code?
Do you use the same mesh for collision that is rendered?
What kind of time-step size are you using, and is it fixed?
What kind of time-step size are you using, and is it fixed?
I was performing some search and found this thread.
Perhaps I'm going to ask you a trivial thing but...
[/quote]
- Is the ship a kinematic body?
- If yes, have you disabled deactivation?
- Are you using the provided "car simulation" code?
I'm glad you found it! ;)
1.: No, it's a normal rigidbody.
2.: -
3.: Nope, I have written one myself, using the scripting feature of our engine. The whole thing is a raycast vehicle which moves around by applying forces.
The script is a bit messy because of the tests I had to do, but I'll clean and post it if it's needed.
Do you use the same mesh for collision that is rendered?
What kind of time-step size are you using, and is it fixed? [/quote]
- No, the collisionmesh is much simpler. I also tried the whole thing with a simple cube, and it happened there as well.
- I can't really answer that question, because I don't know which timestep you exactly mean. Bullet uses an internet one as far as I know. Here is my Update()-Function:
/** Call this to update the physics */
void BulletPhysicsEngine::Update(float DeltaTime)
{
if(ThreadWork.bRunSimulation)
{
const boost::mutex::scoped_lock sl(ThreadWork.SimulationMutex);
GetDynamicsWorld()->stepSimulation(DeltaTime, BULLETPHYSICS_MAX_SUB_STEPS);
}
}
DeltaTime is usually around 0.02ms (0.00002). I run my rendering in a seperate thread, that is why it is so low.
BULLETPHYSICS_MAX_SUB_STEPS is left to the default value of 1. The fixed internal Timestep value is as well left to the default.
Could you recommend some settings for this to me?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement