|
Re: some a6 physics questions
#15426
04/27/03 02:33
04/27/03 02:33
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
code:
function emit_sphere();
action sphere { my.shadow=on; phent_settype(my, PH_RIGID, PH_SPHERE); phent_setmass(my, 5, PH_SPHERE); phent_setfriction(my, 70); phent_setelasticity(my, 50, 10); phent_setdamping(my, 20, 20 ); temp.x=cos(camera.pan)*cos(camera.tilt)*300000; temp.y=sin(camera.pan)*cos(camera.tilt)*300000; temp.z=sin(camera.tilt)*300000; phent_addforcelocal(my,temp,nullvector);
on_mouse_left=null; sleep(5); on_mouse_left=emit_sphere; ent_remove(my); } string mdl_sphere=<sphere_0.mdl>; function emit_sphere() { temp.x=camera.x+cos(camera.pan)*cos(camera.tilt)*100; temp.y=camera.y+sin(camera.pan)*cos(camera.tilt)*100; temp.z=camera.z+sin(camera.tilt)*100; ent_create(mdl_sphere,temp,sphere); }
on_mouse_left=emit_sphere;
i am also not really good in programming. i just do trial and error all the time!
|
|
|
Re: some a6 physics questions
#15428
04/27/03 03:08
04/27/03 03:08
|
Joined: Mar 2003
Posts: 5,377 USofA
fastlane69
Senior Expert
|
Senior Expert
Joined: Mar 2003
Posts: 5,377
USofA
|
<<Smack!!>> Thanks Vent! It's mostly all there in the setmass routine, duh! A little bit of testing should answer any remaining questions I suppose. Amazing, simply amazing. Full translational AND rotational physics engine. G**damn sweet!
|
|
|
Re: some a6 physics questions
#15430
04/27/03 04:24
04/27/03 04:24
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
code:
var FR_wheel_ID; var FL_wheel_ID; var RL_wheel_ID; var RR_wheel_ID;
action FR_tyre { my.shadow=on; phent_settype(my, PH_RIGID, PH_SPHERE); phent_setgroup(my,2); phent_setmass(my, 5, PH_SPHERE); phent_setfriction(my, 70); phent_setelasticity(my, 50, 10); phent_setdamping(my, 20, 20 ); FR_wheel_ID=phcon_add(PH_WHEEL,my,p_player); phcon_setparams1(FR_wheel_ID, my.x, vector(0,0,1),vector(0,1,0)); phcon_setparams2(FR_wheel_ID, vector(35,-35,0),vector(-360,360,0),vector(0.9,0.001,0)); }
action FL_tyre { my.shadow=on; my.pan=180;
phent_settype(my, PH_RIGID, PH_SPHERE); phent_setgroup(my,2); phent_setmass(my, 5, PH_SPHERE); phent_setfriction(my, 70); phent_setelasticity(my, 50, 10); phent_setdamping(my, 20, 20 ); FL_wheel_ID=phcon_add(PH_WHEEL,my,p_player); phcon_setparams1(FL_wheel_ID, my.x, vector(0,0,1),vector(0,1,0)); phcon_setparams2(FL_wheel_ID, vector(35,-35,0),vector(-360,360,0),vector(0.9,0.001,0)); }
action RL_tyre { my.shadow=on; my.pan=180; phent_settype(my, PH_RIGID, PH_SPHERE); phent_setgroup(my,2); phent_setmass(my, 5, PH_SPHERE); phent_setfriction(my, 70); phent_setelasticity(my, 50, 10); phent_setdamping(my, 20, 20 ); RL_wheel_ID=phcon_add(PH_WHEEL,my,p_player); phcon_setparams1(RL_wheel_ID, my.x, vector(0,0,1),vector(0,1,0)); phcon_setparams2(RL_wheel_ID, vector(0,0,0),vector(-360,360,0),vector(0.9,0.001,0)); }
action RR_tyre { my.shadow=on; phent_settype(my, PH_RIGID, PH_SPHERE); phent_setgroup(my,2); phent_setmass(my, 5, PH_SPHERE); phent_setfriction(my, 70); phent_setelasticity(my, 50, 10); phent_setdamping(my, 20, 20 ); RR_wheel_ID=phcon_add(PH_WHEEL,my,p_player); phcon_setparams1(RR_wheel_ID, my.x, vector(0,0,1),vector(0,1,0)); phcon_setparams2(RR_wheel_ID, vector(0,0,0),vector(-360,360,0),vector(0.9,0.001,0)); }
action car { p_player=my; wait(1); my.shadow=on; my.material=mat_metal; phent_settype(my,PH_RIGID,PH_BOX); phent_setgroup(my,2); phent_setmass(my,40,PH_BOX); phent_setfriction(my,50); phent_setelasticity(my,50,10); phent_setdamping(my,20,20); vec_for_vertex(temp,my,306); ent_create(mdl_tyre,temp,FR_tyre); vec_for_vertex(temp,my,36); ent_create(mdl_tyre,temp,FL_tyre); vec_for_vertex(temp,my,5); ent_create(mdl_tyre,temp,RL_tyre); vec_for_vertex(temp,my,304); ent_create(mdl_tyre,temp,RR_tyre); }
why does my car explode when this code runs? first i create the car and the car creates it's tyres then. after reading the manual i came to the conclusion that this would be the way to do it...
and what do the spring damper constants exactly do?
|
|
|
|