Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TedMar, AndrewAMD), 1,344 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 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 | chip programmers | 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