1 registered members (BrainSailor),
862
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: how can i move my entity from vector Temp1 to Temp2
[Re: Ascalon]
#299957
11/28/09 14:13
11/28/09 14:13
|
Joined: Mar 2009
Posts: 207
Erick_Castro
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 207
|
Ascalo, thank you. But i think it doesnt work I will test it
Last edited by Erick_Castro; 11/28/09 14:31.
|
|
|
Re: how can i move my entity from vector Temp1 to Temp2
[Re: Ascalon]
#299971
11/28/09 15:41
11/28/09 15:41
|
Joined: Mar 2009
Posts: 207
Erick_Castro
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 207
|
This is the code, Ascalon.
VECTOR my_pos; VECTOR target_pos; VECTOR temp;
target_pos.x = -1012; target_pos.y = 413; target_pos.z = 594; vec_set(temp,target_pos.x); vec_sub(temp,my.x); vec_to_angle(my.pan,temp);
while(1) { if ( my.status == 1) { c_move (my, vector(10, 0, 0), NULL, GLIDE); run_percentage += 6 * time_step; wait(1); } wait(1); }
As yo see, i defined target_pos as a vector -1012,413,594 coordinates. The entity go good to that vector but then continues flying on the space i need a code that when get the specified coordinates it stop the entity there.
The code works good, the only thing that i need is to stop the fly of the entity when it reach the position of target_pos
Thanks
Last edited by Erick_Castro; 11/28/09 15:44.
|
|
|
Re: how can i move my entity from vector Temp1 to Temp2
[Re: Erick_Castro]
#299973
11/28/09 16:30
11/28/09 16:30
|
Joined: Mar 2009
Posts: 88
Walori
Junior Member
|
Junior Member
Joined: Mar 2009
Posts: 88
|
You could try adding vec_dist to the code: Original:
while(1)
{
if ( my.status == 1)
{
c_move (my, vector(10, 0, 0), NULL, GLIDE);
run_percentage += 6 * time_step;
wait(1);
}
wait(1);
}
To:
while(1)
{
if ( my.status == 1 && vec_dist(my.x,target_pos.x)>= 10)//Where 10 is the distance you want instructions to be executed
{
c_move (my, vector(10, 0, 0), NULL, GLIDE);
run_percentage += 6 * time_step;
wait(1);
}
wait(1);
}
Now when entity is close than 10 quants of target_pos it'll stop the movement
|
|
|
|