Object sinks through ground after slight collision/penetration

Posted By: Hammer_Studio

Object sinks through ground after slight collision/penetration - 12/04/09 22:36

I'm just starting to program in Lite-C, so this should be a quick fix. I'm trying to just get the basic concepts behind creating and object and passing it to the physics engine. Problem is, when I do it, it sinks right through the ground, almost as if the ground is made of some liquid. I know this isn't the case, because it's the same ground from earthball, so I have no clue what's happening. Do I need something set up differently in MED or something? I remember clicking some button that made the objects look more blocky, rather than smooth, could that have caused this in some way? anyways, here's my code:

function main()
{

level_load("small.hmp");
ENTITY* object;
object = ent_create("test_Torus.mdl", vector(10, 20, 30), NULL); //test_Torus is the basic torus#2 shape from the MED

phent_settype(object,PH_RIGID,PH_POLY);
phent_setmass(object,1,PH_POLY);
phent_setfriction(object,90);
phent_setelasticity(object,75,100);
phent_setdamping(object,30,5);
ph_setgravity(vector(0,0,-50));

}
The torus is spawned above the terrain, and falls a few feet to the ground, where it is slowed temporarily, but then sinks through.
Posted By: Damocles_

Re: Object sinks through ground - 12/04/09 23:48

start debugging by creating the object high enough above the ground

vector(10, 20, 30), -> vector(10, 20, 300)

Might be caused by the object beeing spawned already inside the terrain.
Posted By: Hammer_Studio

Re: Object sinks through ground - 12/05/09 12:02

=( unfortunately, it is not that simple. It's spawning well above the terrain. When if falls, there is some collision, to the extent that the torus' fall is briefly slowed to a near stop, however it then continues to sink, like how when Golum in LotR 3 hit the lava, then begun to sink. I'm tempted to think that somehow it's only applying the physics to the individual vertexes, rather than as to the object's faces as well.
Posted By: bart_the_13th

Re: Object sinks through ground - 12/05/09 12:34

I've never used any physics before, but how about your models zero origin? It(the origin) should be ewhere near the model's center...
Posted By: Widi

Re: Object sinks through ground - 12/05/09 19:30

From the Manual: "Do not use PH_POLY or PH_CYLINDER hulls for moving entities".

And.... please no doubleposts !!!
© 2024 lite-C Forums