physics stop working, why?

Posted By: Muhsin

physics stop working, why? - 05/25/10 21:25

Hi!

I just began today playing with the physic engine of gamestudio.
then I got a problem.

I tried to build a house using bricks, which all use this code:

---------------------------------------------
action box()
{
phent_settype(my,PH_RIGID,PH_BOX);
phent_setmass(my,1,PH_BOX);

phent_setfriction(my,100);
phent_setelasticity(my,1,0);
phent_setdamping(my,50,6);
ph_setgravity(vector(NULL,NULL,-800));
}

---------------------------------------------

I found out that if I stack to many bricks on each other, they lose their physics.
they still have their physics if I make the same amount of bricks around the game without them touching each other, but as soon as they touch each other, they lose their physics.

then I tried to make balls with physics touch the bricks, and the balls lost their physic too!

what can be the problem? is there some kind of limit or something? please help.


thanks!


- Muhsin Kaymak
Posted By: ventilator

Re: physics stop working, why? - 05/25/10 21:41

gamestudio's physics engine ODE uses an O(n^3) solver by default. this means that performance and memory usage scales cubically with the number of touching physics objects. so the number of physics objects in a stack is quite limited as you can imagine.

in older engine versions a stack overflow caused an engine crash in such cases but now there seems to be some safety mechanism to prevent that. freezing physics isn't that great either though. laugh

other physics engines use algorithms that scale better but you can't really do a house made with thousands of bricks with them either. it still takes to much processing power. additionally many engines only can achieve algorithms that scale better by using cheats that lead to more unrealistic physics (spongy objects, jittering, clamped mass ratios,...).
Posted By: Muhsin

Re: physics stop working, why? - 05/25/10 21:52

so there isn't something wrong with my code, but the way gamestudio uses physics?

ok, thanks.

is there another way to stack objects on each other without making the physics to freeze?

thanks

- Muhsin Kaymak
Posted By: Random

Re: physics stop working, why? - 05/26/10 09:55

Yes, use Newton.
It isn`t that hard.
Posted By: Muhsin

Re: physics stop working, why? - 05/26/10 10:48

ok, thanks I will try that!
© 2023 lite-C Forums