Game Development Community

Change pathMarker position

by Douglas Higa · in Technical Issues · 07/17/2006 (2:07 pm) · 1 replies

Ok, im trying to move my pathMarkers so that my path can be always at the left side of my car. so i did this code:

function serverCmdAddPath(%client, %path)
{
//get pos of marker
%node = %path.getObject(3);
%pos0 = %node.getTransform();

// get pos of player
%pos = %client.car.getEyeTransform();
// %pos = %client.car.getTransform();

// move marker 10 units left
%x = getword(%pos,0); // get the current transform values
%y = getword(%pos,1);
%z = getword(%pos,2);
%x -= 10; // adjust the x axis position
%pos = %x SPC %y SPC %z SPC "0 0 1 0" ;
%node.setTransform(%pos);

//calculates difference between initial anf final pos.
%delta = vectorSub( %pos, %pos0 );

//move the other markers
for ( %i=0 ; %i<%path.getCount() ; %i++){

if ( %i != 3 ){
%node = %path.getObject(%i);
%pos0 = %node.getTransform();
%pos = vectorAdd( %pos0, %delta );
%node.setTransform( %pos );
}

}

}

#1
07/17/2006 (2:08 pm)
Now, my problem is that, if i just rotate my car 180 degrees, the path should move too, but it dont happen. how can i fix it please?