1 registered members (AndrewAMD),
16,038
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Grabing and Throwing An Object - Problem
#225584
09/05/08 08:14
09/05/08 08:14
|
Joined: Jul 2008
Posts: 23 Turkey
Hatean
OP
Newbie
|
OP
Newbie
Joined: Jul 2008
Posts: 23
Turkey
|
I and a friend of my is developing a little test game. We are trying to write a code for grabbing and throwing an object. We wrote some codes but it is not exactly what we want We Wrote That function t_kola();
function kola_f_event () { if(event_type==EVENT_SCAN && you==player) { ent_create("cola_can.mdl",my.x,t_kola); ent_remove(me); } }
action kola_fizik () { my.emask|=ENABLE_SCAN; my.event=kola_f_event; phent_settype(my,PH_RIGID,PH_BOX); phent_setmass(my,75,PH_SPHERE); phent_setdamping(my,30,30); phent_setfriction(my,10); ph_setgravity(vector(0,0,-386)); phent_addforceglobal(me,vector(1000,0,0),nullvector); }
function t_kolaEvent() { VECTOR temp4; my.skill50=1; if(event_type==EVENT_SCAN && you==player) { set(my,PASSABLE); while(my.skill50==1) { vec_for_vertex(temp4,player,32); my.x=temp4.x; my.z=temp4.z-10; my.y=temp4.y; my.pan=player.pan; if(mouse_right) { my.skill50=0; } wait(1); } ent_create("cola_can.mdl",vector(my.x,my.y,my.z),kola_fizik); ent_remove(me); } }
action t_kola() { my.emask|=ENABLE_SCAN; my.event=t_kolaEvent; }
"phent_addforceglobal(me,vector(1000,0,0),nullvector);" when we make 1000 value higher, it doesn't make sense. We tried 100000, but result is same, not throwing away enough...Also I am sure there should be an other way that not using ent_create's. And of course there should be a better way to grab the object (in that code you can grab it but it doesn't look like real). We tried using trigonometry to define the grabbed objects position but it doesn't work:cola_can.x = player.x+sin(player.pan)*10; cola_can.y = player.y+cos(player.pan)*10; cola_can.z = player.z; Also We Wrote That And I'm Pretty Sure That This Was Supposed To Work // Cola Can #define GRAB skill50 function t_kolaEvent() { VECTOR vec_grab; VECTOR firlatma;
vec_zero(vec_grab); vec_zero(firlatma); if(event_type==EVENT_SCAN && you==player) { my.GRAB=1; set(my,PASSABLE); while(my.GRAB==1) { vec_for_vertex(vec_grab,player,32); my.x=vec_grab.x; my.z=vec_grab.z-10; my.y=vec_grab.y; my.pan=player.pan; if(mouse_left) { my.GRAB=0; while(mouse_left) { vec_for_vertex(vec_grab,player,32); my.x=vec_grab.x; my.z=vec_grab.z-10; my.y=vec_grab.y; my.pan=player.pan; firlatma.x+=10; wait(1); } phent_addforceglobal(me,firlatma,nullvector); } wait(1); } } }
action t_kola() { my.emask|=ENABLE_SCAN; my.event=t_kolaEvent; phent_settype(my,PH_RIGID,PH_BOX); phent_setmass(my,75,PH_SPHERE); phent_setdamping(my,30,30); phent_setfriction(my,12); ph_setgravity(vector(0,0,-386)); }
If you got any ideas about it please share them with us. Especially we are trying to make second code work. Waiting for help. Thanks...
Last edited by Hatean; 09/05/08 10:19.
The Life Game is disgustingly bad but the graphics and reality are extremely cool...
|
|
|
Entire Thread
|
Grabing and Throwing An Object - Problem
|
Hatean
|
09/05/08 08:14
|
|
|