moving to a certain point on the map

Posted By: PrenceOfDarkness

moving to a certain point on the map - 09/08/11 22:05

I'm trying to make an object move towards the center of the map. However with the method I'm using the object's speed gets slower. Is it possible to do what I want to do with out making the object have to face the center (in other words I don't want to use entity coordinates I want to use world coordinates).

Code:
while(1){
wait(1);
vec_set(tempVec,my.x);
vec_sub(tempVec,vector(0,0,0));
		vec_mul(tempVec,vector(-1*time_step,-1*time_step,-1*time_step));

c_move(me,0,vector(tempVec[0]*0.01,tempVec[1]*0.01,tempVec[2]*0.01),IGNORE_PASSABLE | GLIDE);
}


Posted By: Superku

Re: moving to a certain point on the map - 09/08/11 22:26

vec_diff(temp,nullvector,my.x); // you can copy and invert the vector my.x, too
if(vec_length(temp) > 25)
{
vec_normalize(temp,25*time_step); // 25 is your speed
c_move(me,nullvector,temp,...);
}
© 2024 lite-C Forums