Path problem

Posted By: kombuwa

Path problem - 02/06/08 03:27

can anyone say good tutorial about path(move entity in a path )?
please,
Posted By: kombuwa

Re: Path problem - 02/06/08 09:39

how to move a object on a path?
Posted By: oldschoolj

Re: Path problem - 02/06/08 16:29

if you're looking to just simply move an object along a plath its quite straight forward. Try this:

Code:
#define MOVEMENT_SPEED skill1
var dist = 0; // entity path
var vLastPos[3];
var vDir[3];

action the_entity ()
{
path_set(my, "the_path");
while(1)
{
path_spline(me,my.x,dist);
dist += 5*time_step;
vec_diff(vDir,my.x,vLastPos);
vec_to_angle(my.pan,vDir);
vec_set(vLastPos,my.x);
ent_animate(my, "walk", my.MOVEMENT_SPEED, ANM_CYCLE);
my.MOVEMENT_SPEED += 30 * time_step;
wait(1);
}
}



you can either assign this action to the entity in wed, or turn it into a function and assign it to an entity that you've created in your script. If you have a action already for the entity, then just put this in your current action.


Posted By: kombuwa

Re: Path problem - 02/08/08 04:11

thank you for help.
code is working fine.

now i have another problem. it is how to find next node of path.
Code:
 
next_nod=path_nextnode(my,path_getnode(me,1,1,my.skill2),path_getedeg(me,1,1,my.skill1));

next_nod= path_scannode(my,path_getnode(my));



i have tryed this methods but faile.

i want to get current node vector position and next node vector position to
calculate angel like this
Code:

ang_c=atan(((next_node.x-curr_node.x)/next_node.y-curr_node.y));
vec_to_angle(my.pan+ang_c,vDir);


Posted By: kombuwa

Re: Path problem - 02/09/08 07:12

can anyone help me for problem that occurred in Path, node.

i want to get next node x,y

for calculate and set angel of object move in path
Posted By: Anonymous

Re: Path problem - 02/09/08 08:55

Hi kombuwa,

here is a test app for the GS paths I made several weeks ago.
It shows the most possibilities of the path technique plus has the not in lite-c/c-script implemented function (but highly needed) path_prevnode (de)
I also shows the way to use more edges from one node.

test app for lite-c

test app for c-script

I think this gives you enough hints to get the way to use paths?

have fun, mercuryus
© 2024 lite-C Forums