|
Gravity by using the physics
#163603
10/26/07 19:34
10/26/07 19:34
|
Joined: Aug 2006
Posts: 96 Netherlands
Polypfreak1987
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 96
Netherlands
|
I am trying to have an entity with a gravity by using the Physics engine. But it don't work. The entity is like a pendelum. It rotates around a certain point, but normaly it uses the gravity to swing. I have this code now, but I don't know if I am doing this right. Code:
phent_settype(my,PH_RIGID,PH_BOX); phent_setmass(my,50,PH_SPHERE); phent_setdamping(my,100,100); phent_setgroup(my,1); ph_setgravity(earthGravity); ph_selectgroup(1);
The var earthGravity is defined in the script. And this script is into the action of the entity. I hope you can help me, because I still don't understand how to script gravity...
|
|
|
Re: Gravity by using the physics
[Re: Scorpion]
#163605
10/27/07 05:59
10/27/07 05:59
|
Joined: Aug 2006
Posts: 96 Netherlands
Polypfreak1987
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 96
Netherlands
|
Quote:
you shouldn't put ph_setgravity into an action, better in your main function etc... then it would be good, if phent_settype and phent_setmass have the same hulltype. I donno for what you are using it, but if you phent_Setdamping is 100 it don't move is not a force applied.
Make sure earthgravity is something as var earthgravity[3] = 0,0, -386;
Sorry this didn't work. This is the code that I want to use for the gravity. Code:
var earthGravity[3] = 0,0,-386;
function main() { level_load(level_str); ph_setgravity(earthGravity); }
action gondel1 { my.passable = on; my.scale_x = 0.35; my.scale_y = 0.35; my.scale_z = 0.335; phent_settype(my,PH_RIGID,PH_SPHERE); phent_setmass(my,50,PH_SPHERE); //phent_setdamping(my,0,0); phent_setgroup(my,1); ph_selectgroup(1); while(my) { vec_for_vertex(temp,molen,1374); my.x = temp.x; my.y = temp.y; my.z = temp.z; my.pan = molen.pan+45; /*my.skill15 = max(my.skill15,-60); my.skill15 = min(my.skill15,0); if(key_w == 1) { my.skill15 -= 0.2*time_step; } if(key_s == 1) { my.skill15 += 0.35*time_step; } ent_animate(my,NULL,0,0); ent_bonerotate(my,"gondel_rood_axis",vector(0,0,my.skill15));*/ wait(1); } }
Now I use a bone animation to simulate the gravity, but it is not a natural movement. So I want to do a natural movement of the entity.
In fact, I am making a wave swinger and this action is for one of the gondela's. So it needs to swing out by the G-forces.
|
|
|
|