Object sinks through ground

Posted By: Hammer_Studio

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

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: Rei_Ayanami

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

Please no double posts!
Posted By: Widi

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

First the same: Please do not doubleposts.

To your problem, from the manual: "Do not use PH_POLY or PH_CYLINDER hulls for moving entities"
Posted By: Hammer_Studio

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

sorry, couldn't figure out how to remove the other one/move it here.... anyways, what Am I supposed to do then if I want a moving entity with physics applied to it?
Posted By: Widi

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

phent_settype(object,PH_RIGID,PH_SPHERE);

edit: or PH_BOX
© 2024 lite-C Forums