Jump to content

Sign in to follow this  
Belbo

Move marker to rear of a vehicle

Recommended Posts

Hey, guys. I'm currently looking for a way to move a marker to a position relative to the facing of a vehicle. I want the marker to follow the vehicle, but not at the position of the vehicle at the given moment nor a position relative to the x,y,z-coordinates of the map. The marker should be placed a couple of meters behind the vehicle, no matter which direction the vehicle is facing. Anyone's got an idea?

while {true} do {
"MARKERNAME" setMarkerPos [(getPos object1 select 0, ((getPos object1 select 1) -3), getPos object1 select 2];
sleep 2;
};

Share this post


Link to post
Share on other sites

What about:

markername attachto [vehiclename [0,0,0]];

Iam using it to attach objects to each other, and you can set possition relative to the center of the object you are attaching to.

I never used it for markers, but i think there is no reason why it shouldnt work for them.

Share this post


Link to post
Share on other sites
  Mirek said:
I never used it for markers, but i think there is no reason why it shouldnt work for them.

I'm fairly sure it doesn't work. Markers aren't objects. That's one part of the problem. Otherwise a simple setVectorDir would suffice.

Share this post


Link to post
Share on other sites

The relevant portion is borrowed from Warfare's GetPositionFrom script:

while {true} do { 
_position = getPos object1;
_distance = 3;
_dir = getDir object1;
_direction = _dir + 180;
"MARKERNAME" setMarkerPos [(_position Select 0)+((sin _direction)*_distance),(_position Select 1)+((cos _direction)*_distance)];
"MARKERNAME" setMarkerDir _dir;
sleep 2;
}; 

I noticed you were using 3d position, but markers use 2d position format.

Share this post


Link to post
Share on other sites
  OpusFmSPol said:
  Reveal hidden contents

Thank you, I'll give this a try!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×