Page 1 of 1

vehicle slide under ceiling

Posted: Sat Feb 18, 2012 2:38 am
by atsamy
in my game i have a vehicle and a kind of low ceiling that the vehicle is not suppose to get under, but when a collision happens the vehicle kind of slide under ceiling, i dont want to play with the wheel suspension constant, another thing when a box fall onto the vehicle the box kinda sink through it and the whole vehicle pops above the box, playing with masses make it better but i want the box to have a big mass, thanks in advance

Re: vehicle slide under ceiling

Posted: Sat Feb 18, 2012 2:55 am
by Norbo
in my game i have a vehicle and a kind of low ceiling that the vehicle is not suppose to get under, but when a collision happens the vehicle kind of slide under ceiling, i dont want to play with the wheel suspension constant
Sorry, I'm not quite sure what you mean here.
another thing when a box fall onto the vehicle the box kinda sink through it and the whole vehicle pops above the box, playing with masses make it better but i want the box to have a big mass, thanks in advance
Really huge mass ratios are nasty. You can increase the Space.Solver.IterationLimit to improve the quality of the solution, but it takes more time to compute.

The best option is to manage the masses of objects so that a really light object isn't responsible for stably supporting a really heavy object. This effect usually isn't very visible because the majority of simulations involve similar masses or light objects which rest on heavy objects, not the other way around. For example, a pickup truck capable of carrying a big block will generally be at least as heavy as the block.

Re: vehicle slide under ceiling

Posted: Sat Feb 18, 2012 9:50 am
by atsamy
here is some pictures i hope it explains
Image
Image

when the vehicle hit the yellow wall it likes push it down ward that would be understood if the vehicle and the wall smooth edges but they have a rough edges, i tried to set the collision margin to 0 but nothing changed.

Re: vehicle slide under ceiling

Posted: Sat Feb 18, 2012 10:01 am
by Norbo
There's two possibilities:
1) The simulation takes discrete steps, so if an object is going fast enough, the car's top could penetrate the block a bit in one frame. In the subsequent frame, the collision detection system finds that the direction of minimum penetration is vertical, jamming the car.

2) It may also happen due to general chaos in a violent collision. The impact may push the back wheels down, and then maybe the front bounces back low enough to wedge beneath.

If it's the former, you might be able to improve it slightly by setting the car's PositionUpdateMode to Continuous. It's an approximation though- very slight glancing collisions are intentionally ignored for the sake of smoothness, so depending on this collision, it still might penetrate. Using a smaller time step duration by setting the Space.TimeStepSettings.TimeStepDuration to something like 1/120f instead of the default of 1/60f and then either updating the space proportionally more often or using internal time stepping would also help a lot.

If the latter is happening, then it is physically 'realistic.' The easiest, fastest, and most robust solution would be to modify the geometry such that it becomes essentially impossible to wedge the car beneath it.

Re: vehicle slide under ceiling

Posted: Sat Feb 18, 2012 10:38 am
by atsamy
well the whole point is that the vehicle shouldn't pass unless its carrying weight, increasing the frame rate helped, thanks norbo for your help :)