I have a model of a car, i want it to move about a predefined route over and over. Now i have read about using Paths to be the way forward. This is what i have done:
clicked Add path and then used vertex move to draw out the area to follow, then i assigned the model of my car to the path in the properties path menu.
Now i am told i need a script to get it to follow it. any ideas on how to do this?
After looking in the manual i found this but not sure if its relevant:
// move along a path loop
// uses _FORCE, _MOVEMODE
action patrol_path
{
// attach entity to nearest path
result = path_scan(me,my.x,my.pan,vector(360,180,1000);
if (result == 0) { return; } // no path found
// find first waypoint
var node = 1; // start at first node
path_nodepos(my,node,my._TARGET_X);
while (my._MOVEMODE)
{
// find direction
result = vec_to_angle(angle,vec_diff(temp,my._TARGET_X,my.x));
// near target? Find next waypoint of the path
if (result < 25) {
node = path_nextnode(my,node,1);
path_nodepos(my,node,my._TARGET_X);
}
// turn and walk towards target
actor_turnto(angle.PAN);
actor_moveahead(MY._FORCE);
wait(1);
}
}
I have never really done any scripting in this before so please bear with me :-)
cheers