Physics ents getting stuck in level blocks....

Posted By: GhostDude

Physics ents getting stuck in level blocks.... - 03/28/04 12:43

I've found that it is pretty easy to get a physics entity stuck in the level geometry. All you need is the entity to hit a block at a decent enough speed (usually not all that much) and part of it will becom lodged inside the block, becoming stuck and no longer responding to gravity, phent_addcentralforce, etc. I've tried to eliminate as many thin walls from my game as possible, but the entity has even gotten stuck on reasonably thick walls and floors, so im not really sure what to do here...
Posted By: feature_creature

Re: Physics ents getting stuck in level blocks.... - 03/30/04 05:51


If this is the same problem I was having, it was reduced by setting the object type to PH_POLY -- but not totally gone.

It also seemed to me that there are particular locations where the object was more likely to pass through the wall than others. I think I read something by ventilator about this, saying, "he knew where to look" for the problem.

I have not had good luck with setting correction values higher because this seems to contribute to the problem of the physics object reacting violently to vertex and edge collisions.

Therefore, I have had best results with PH_POLY and low corrections, but I arrived at this by trial and error and cannot really explain whether this is an appropriate way to do physics.


Posted By: poloman

Re: Physics ents getting stuck in level blocks.... - 03/31/04 15:58

yes, I've met the same problem , when using c_move, c_rotate , with new collision system and move mode set to GLIDE, there no glide at all , it just stuck with terrian, level entity, model entities.

mmmm.......

Maybe we have to wait for the new Octree culling system ?
Posted By: feature_creature

Re: Physics ents getting stuck in level blocks.... - 04/14/04 12:05

I tried something today and it really worked great! I was so pleased that something so simple could have such a big impact!

It's just tracing from the model's origin to 100 quants below it's min_z value (min_z is negative in my model).

Here's a code excerpt:
Code:

//Help the physics engine keep models from sticking in the floor
vec_set(temp,my.pos);
temp[2] += ( my.min_z - 100 );

trace_distance = c_trace(my.pos, temp, IGNORE_ME + IGNORE_PASSABLE );

//if the model is in the floor, push it out some
if ( trace_distance < -my.min_z ) {
phent_enable(my,0);
my.z += .75*(-my.min_z - trace_distance );
phent_enable(my,1);
} //if



Posted By: Marco_Grubert

Re: Physics ents getting stuck in level blocks.... - 04/21/04 10:08

Quote:

I tried something today and it really worked great! I was so pleased that something so simple could have such a big impact!



The physics engine already does something similar.

The base physics system checks whether an object is inside a wall at the beginning of each frame and then tries to push it outside. If your forces are very large, ERP (first value) is low, or CFM (second value) in ph_setcorrections is high, however, this counter-force to keep it outside the wall may not be strong enough to keep the object in the right spot. Also if your object has a high velocity it might start out on one side of the object and be on the other side of it within one frame.

To prevent this after each frame A6 checks (via a ray trace) whether the entity's center has passed from one side of a wall to the other side and if so puts it back to where it was. Again, with high forces, low ERP, high CFM, the object can get extremely close to the wall until it's squeezed in and then the trace will fail.

As usual, if you have a test level with severe problems please send it to mgrubert@conitec.net for inspection.
Posted By: feature_creature

Re: Physics ents getting stuck in level blocks.... - 04/21/04 22:15

I'm working on extracting the problem into a test level so I can analyze it in a more controlled way. What follows are the issues I plan to investigate, if anyone has already dealt with them then that might save me some time.

When a physics object does enter a block or entity -- it seems to get pushed out at very high speed. By intervening when physics is disabled, the result seems to be that the object behaves much more naturally. This high speed coming out of a block is also a problem if you are using phent_setmaxspeed because the body ends up with zero velocity because it reached the max speed.

The problem seems *much* more apparent when traversing a map entity or model.

I agree that if I can keep the forces and velocity low enough, the problem does not seem happen very much, but in many cases this creates a system where everything feels too slow. Would it help to scale the whole world smaller so that lower speeds seemed faster, or would a smaller object just suffer the problem more easily?

When corrections are high, if the phsyics entity penetrates even a small bit it seems to be pushed away at a very high rate. This seems to happen when passing over an edge like at the bottom of a ramp, or if you run into a vertex.
Posted By: Marco_Grubert

Re: Physics ents getting stuck in level blocks.... - 04/23/04 05:25

Quote:

When a physics object does enter a block or entity -- it seems to get pushed out at very high speed.


I fixed a bug a few weeks ago that would cause physics entities to be pushed out of some entities at a very high speed. Do you get the same problem with level geometry, too ? (In that case it is something different)

Quote:

This high speed coming out of a block is also a problem if you are using phent_setmaxspeed because the body ends up with zero velocity because it reached the max speed.


That's a good observation- it explains why sometimes the entity gets stuck in an invalid spot.
Posted By: feature_creature

Re: Physics ents getting stuck in level blocks.... - 04/24/04 12:17

The problem definitely occurs with entities -- I added code to make the player move more slowly when on top of an entity. I found this out using elevators. I kept "sinking into the floor", occasionally getting stuck inside an entity. Usually just thrown off the entity at high speed.

Level geometry is much more stable than entities. With level geometry the problem is more with moving at with higher velocity towards walls. Sometimes the moving entity gets stuck but other times it passes all the way through.

I still want to identify precisely what I think the issues are from my perspective. That way, I'll know if it's a bug or just a question of my learning to use the system appropriately. I appreciate your help very much, Marco.

I'll get to work on my "experiments" (putting on mad scientist costume as I type) and try to be as clear as possible about what I perceive as a problem.

Thanks again.
© 2024 lite-C Forums