Why are Lite-C Physics slow?

Posted By: MrCode

Why are Lite-C Physics slow? - 08/17/07 08:10

Hi, all, I'm using the Lite-C free version and A6.60 Commercial.

I don't know why, but I have to put in massive values for my physics forces if I want them to work properly.

I don't know if this is due to my objects being too massive or not.

Could it be because I'm compiling my levels with A6? It might be the rendering tree that's causing the problems. I don't know.

Here's my Code:

#include <acknex.h>
#include <default.c>

action phys_obj()
{
phent_settype(me,PH_RIGID,PH_BOX);
phent_setmass(me,2,PH_BOX);
phent_setelasticity(me,10,5);
phent_setfriction(me,35);
}

action phys_ball()
{
phent_settype(me,PH_RIGID,PH_SPHERE);
phent_setmass(me,5,PH_SPHERE);
phent_setfriction(me,70);
phent_setelasticity(me,10,5);
phent_setdamping(me,0,0);
while(1)
{
phent_addcentralforce(me,vector(1000 * (key_cul - key_cur),0,0));
phent_addcentralforce(me,vector(0,1000 * (key_cud - key_cuu),0));
camera.x= my.x;
camera.y= my.y + 100;
camera.z= my.z + 100;
camera.pan= -90;
camera.tilt= -40;
wait(1);
}
}

void main()
{
video_mode= 8;
video_screen= 1;
level_load("line3d_etst.wmb");
wait(3);
ph_setgravity(vector(0,0,-300));
ph_fps_max_lock= 75;
ent_create("earth.mdl",vector(100,0,0),phys_ball);
wait(1);
ent_create("dummy.mdl",vector(-17,0,0),phys_obj);
ent_create("dummy.mdl",vector(17,0,0),phys_obj);
ent_create("dummy.mdl",vector(0,-17,0),phys_obj);
ent_create("dummy.mdl",vector(0,17,0),phys_obj);
ent_create("dummy.mdl",nullvector,phys_obj);
}


Posted By: fastlane69

Re: Why are Lite-C Physics slow? - 08/17/07 16:30

Defing "massive" and "properly".

There is no fixed value that the physics engine should work at, only that which works for you. Hence if it works it works.

I'm using A6 physics and have no problems with it which is why I ask to better define your problem to see if it IS a problem.
Posted By: MrCode

Re: Why are Lite-C Physics slow? - 08/17/07 21:02

I have my phent_setmass really low, and yet I have to multiply 1000 with (key_cuu/cud - key_cul/cur) in my forces (phent_addcentralforce).

I don't remember having to put that much force on physics objects before.

I'll probably have to kick myself if it's the ph_setgravity being too high.
Posted By: fastlane69

Re: Why are Lite-C Physics slow? - 08/17/07 22:20

I usually put forces in the thousands as well... don't really think anything of it.

But if this is different you might want to bring it up on the "ask conitec" or "bug report" forum so JCL/Doug can comment.

I'm not using c-lite yet so I have not noticed any difference in using A6.6 physics.
Posted By: D3D

Re: Why are Lite-C Physics slow? - 08/18/07 13:29

Noticed in A7 with Lite-C Test Run, the physics are different than running a compiled version.
Posted By: frescosteve

Re: Why are Lite-C Physics slow? - 08/25/07 00:15

To be consistent with standards you should use kilograms as the unit of mass. The conversion factor from pounds (on Earth) to kilograms is 1 lb. = 0.45 kg

Force accelerates entities according to the Newton formula speed = time * force / mass. Thus for higher acceleration or heavier entities you have to use a stronger force or apply them during a longer time.
Posted By: Spirit

Re: Why are Lite-C Physics slow? - 08/25/07 07:50

When you dont make programming mistakes the speed and forces are exactly the same in A7 lite-C or in A6 C-Script. This is only a different language but its the same physics engine. I converted my physics program with no problem.
© 2024 lite-C Forums