i am using pandas build-in physics engine and the physics collision handler for my cargame.
my problem is that it is possible to drive through the walls that border my racing course. So the collision detection is maybe not absolut safe when it comes to check collisions with other polygons.
Does anybody has an idea how i can fix this problem?
First, easy thing to do is to enable detection of motion, as described in the manual under Rapidly-Moving Objects.
If you have already done that and you are certain it is working, and you are still having problems, you can try simple tricks like increasing the size of your collision sphere, and increasing the size of your polygons; putting a second wall behind your first one in case the first one slips (it has to be far enough back not to cause conflicts); and so on. You should write your game so that you can tolerate the occasional slip, because it will happen.
If you were clever, you could design the walls of your racetrack with CollisionPlanes instead of CollisionPolygons. Planes have the nice property that they are infinitely thick, so they absolutely never miss. Unfortunately, they are also infinitely wide, so you can’t have any part of your racetrack behind a plane. This is OK as long as your racetrack walls can be completely described as a convex hull, but if your racetrack is more complex than a simple oval, you will have problems with interference with planes from another part of the track. This is where the cleverness comes in: you can use knowledge of which part of the track you are currently on to enable and disable the appropriate walls, so that you are only testing against CollisionPlanes that are near you. If you can do this, you can make CollisionPlanes work, and the collision system will be absolutely perfect (as long as you can accurately figure out which part of the track you are on).
It’s also possible to enable collision region visualization for debugging purposes. If NONE of the polygons are registering collision, it may be that your collision system just isn’t quite set up correctly. I’ve never had a pervasive miss situation in sphere-vs-poly collision where the polys were facing the right way, callbacks were registered properly, etc.
i added the lines that are descriped in the manual under Rapidly-Moving Objects. I think its got a little bit better but unfortunatly there are still some collisions that are not right detected.
I have a problem with point 2. when i am adding the line:
in my main loop i am getting the message: “ShowBase instance has no attribut ‘resetPrevTransform’”.
Unfortunatly it makes no really difference if i increase the size of my collisionSphere or when i put a second wall behind the first one.
you wrote that the best way would be to have different collisionPlanes that are only enabled when you are really near to them. that sounds interessting! do you maybe have an example for this?
yes, i know this ode car already its really cool! but when i am using this script with a higher resolution car model (about 30,000 polys) which i made in 3ds max i get very offen an ode internal error:
and with high resolution models the game unfortunatly gets a little bit slow on my laptop. but the script is definitely cool and makes really fun to play!
so you were certainly doing something wrong - normally either with ODE or panda internal phisics you wouldn’t use an high poly model in physics calculations but a very low poly one so I don’t think that’s the problem…
do you never get this “ode internal error”? because sometimes i get it with the original script, too. but not so often as when i am using a high poly model. but when you google this failure message you will get a lot of entries. so some people unfortunatly are having this problem with ode.
but because its a very good script and the physics calculations are realistic i would be happy when i could set up this script with high poly models.
do you have an idea where i could have made a mistake?
well honestly I ain’t seen that error even once.
Just in case, I tested the ode code with a 46K polycount model and all work smooth and sweet. By the way I run it with my rig n.1 (see my signature) - I provided you the whole stuff here including blender sources so that you may download it and try for yourself.
Let us know how it goes.
Just in general, if you aren’t using your graphical model as your collision model and a high-poly model is giving you errors, there are very few ways the polycount error could be related to the collision system. If you are using your graphical model as your collision model and your visual model is high-poly… you’re probably doing something wrong. Most of the time you can get by with a Panda-defined sphere for collision, or at worst a super-low-poly convex hull around your visual model. The smaller your collision polys, the more collision artifacts you’ll have, and the the slower (exponentially) your collision system will run.
Google for the bNormalizationVector thing - it has come up on the ODE mailing lists and on the Panda3D forums.
It doesn’t appear on Linux since the ODE build that ships with Panda there is a Release build, that’s why it does appear on Windows. I think it has something to do with center-of-mass not aligned correctly or so.
yes, i downloaded the whole stuff now and everything is working nearly fine. i got this error message only one time. that was at the jump on the course after landing on the street again…
but this is cool. it works with nearly all models. its definitely tricky in this script to hide this big wheels and use them still for driving so maybe i will try to add some lines for the visible spinning and turning of the wheels…