Page 1 of 1

Planet & Collisiondamage

Posted: Wed Aug 31, 2011 10:28 pm
by The Jo
Collision is not properly detected on planets. I'm not sure if collision is detected "right" in general :-)
When turning off collisiondamage, it is quite easy to fit a collisionshape to a planet.
But when collision damage is enabled, usually collisions are detected before a spaceship or rocket touches the planet surface. Somehow the collision can't be understood intuitively, since there are crashes although one was moving parallel to the planet's surface.

Maybe related is the rocket behaviour: A Collision is detected if you are simply close enough. This can also be counter intuitive. E.g. in MissionOne.oxw. Try to kill the second box with manual rockets, then the third one and then the fourth one. In most cases the destruction order will be 1st, 2nd, 3rd :?

Re: Planet & Collisiondamage

Posted: Thu Sep 01, 2011 7:24 pm
by 1337
I don't know exactly what's causing this, but I might have an idea...

These are two citations from the Bullet manual:
Avoid very small and very large collision shapes
The minimum object size for moving objects is about 0.1 units. When using default gravity of 9.8,
those units are in meters so don’t create objects smaller then 10 centimeter. It is recommended to keep
the maximum size of moving objects smaller then about 5 units/meters.
Avoid large mass ratios (differences)
Simulation becomes unstable when a heavy object is resting on a very light object. It is best to keep the
mass around 1. This means accurate interaction between a tank and a very light object is not realistic.
You can find the manual here

In terms of size, this gives us a maximum ratio of 1:50 whereas a planet in real life is about 500'000 times larger than an F/A-18 fighter jet.
So we'd have to reduce the game planet size by about 5.5 magnitudes if we want to keep collision functional for projectiles.

Re: Planet & Collisiondamage

Posted: Thu Sep 01, 2011 7:45 pm
by x3n
I'm not exactly sure how collision damage is calculated. I guess it uses a callback from bullet, so if there is collision damage, then there was indeed a collision with the planet. There should be no difference if you activate collision damage. But maybe 1337 is right and collisions are sometimes triggered too early because the simulation is unstable? Without collision damage you may not notice it because it's only for a single tick... but that's just a guess, no clue.

About projectiles: I think the collision radius of projectiles is greater than the radius of the projectile itself. This is often intended to make it easier to hit enemies. However it might be a bit too large for some projectiles... this could be adjusted.

@Planet size and projectiles: Projectiles don't have to bounce from the planet's surface. In fact projectiles are not even real physical objects, they are ghost objects which don't collide with other objecst. Instead they only receive a callback from bullet. No one cares if this callback is a little too early or too late if you hit a planet. ;)

Also collision with planets is not even really needed for ships. If you allow a player to fly that close to a planet until he smacks his forehead on the planet's surface, you have a problem anyway. Instead we should apply some damage if you enter the atmosphere, issue a warning, and finally destroy the ship if it gets too close. At least that's how I experienced it in other games. We could do it differently of course.

Re: Planet & Collisiondamage

Posted: Thu Sep 01, 2011 8:18 pm
by 1337
We should definitely see to it that we apply real Bullet physics only when necessary or really beneficial. Planets do not belong to that in my opinion.