Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 13,972 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Shoot an arrow #213718
06/30/08 10:39
06/30/08 10:39
Joined: Jan 2002
Posts: 454
Germany
CD_saber Offline OP
Senior Member
CD_saber  Offline OP
Senior Member

Joined: Jan 2002
Posts: 454
Germany
Hello,
i hope that you are able to help me. I'm working on a bow/arrow script using the physic engine. My problem is that I am not able to let the arrow fly in the right direction where i point with the camera.

I tried this function for the arrow:

function physikpfeil2()
{
pfeil2 = me;
var temp[3];


phent_settype(my,PH_RIGID,PH_BOX);
phent_setmass(my,5,PH_BOX);
phent_setelasticity(my,10,5);
phent_setfriction(my,30);
phent_setdamping(my,5,3);

while(vec_dist (my.x, player.x) < 10)
{
vec_set(my.pan,camera.pan);
vec_rotate(shot_speed,camera.pan);

if (vec_dist (my.x, player.x) < 10) {my.passable = on;}

// vec_scale(temp[0],1000);
vec_normalize(shot_speed,1000);
phent_addcentralforce(my,shot_speed);

wait(1);
}

}


this is from where i get the vector:

my.skill44 = 0.5 * screen_size.x;
my.skill41 = 0.5 * screen_size.y;
my.skill42 = 20;
vec_set (my.skill43, my.skill40);
my.skill45 = 10000;
vec_for_screen (my.skill44, camera);
vec_for_screen (my.skill43, camera);
trace_mode = ignore_me + ignore_passable;
target = trace (my.skill44, my.skill43);
vec_set (gun_target, target);
vec_diff (shot_speed, gun_target, player.pos); vec_normalize(shot_speed, 10000000);


I this is how the arrow is created

ent_create(arrow_mdl,camera.x,physikpfeil2);


I think that this is not a very good solution for the problem... and it doesn't work...

Does somebody has a better solution for the problem??

Thank you very much!


Ja, lach du nur du haariges Pelzvieh!
Re: Shoot an arrow [Re: CD_saber] #213965
07/01/08 16:43
07/01/08 16:43
Joined: Jan 2002
Posts: 454
Germany
CD_saber Offline OP
Senior Member
CD_saber  Offline OP
Senior Member

Joined: Jan 2002
Posts: 454
Germany
Anyone?


Ja, lach du nur du haariges Pelzvieh!

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1