Jump to content
Sign in to follow this  
cc_kronus

relative movement of a marker

Recommended Posts

Perhaps some of the coding gurus can help me.

I know how to spawn a marker at a vehicle, but how can I move the marker to a position, say, 5 meters to the right of the vehicle? (with independence of where the vehicle is on the map and to where it is heading) I've been searching but could not find any clue.

Setmarkerpos moves the market but uses either another object's position or a 2D position with X and Y map coordinates, which in my case is not helpful.

Any idea?

Share this post


Link to post
Share on other sites

I'm not a guru, but try this. Idk if it would work with a marker, I see no reason why not. You can use negative values too. ie; -5

"MrkName" SetMarkerPos (VehName ModelToWorld [5,0,0]); // [x,y,z]

Share this post


Link to post
Share on other sites

can you attach an invisible object to the said vehicle at the correct distance away - then create the marker and attach it to the invisible object? just a thought

Share this post


Link to post
Share on other sites

I guess you could use a BIS function to calculate the position, you would need a functions module on the map if you wanted to use this method.

_markerPos = [vehName, 5, 90] call BIS_fnc_relPos;

That will give you a position 5 meters from the vehicle on a compass bearing of 90.

Share this post


Link to post
Share on other sites

modelToWorld does work? If you want the marker always to the right of the vehicle, no matter what vehicle direction :)

"markerName" SetMarkerPos (vehicleName ModelToWorld [5,0,0]);

Try that in a radio trigger, BIS_fnc_relPos is the other good option (was going to suggest it last night until I found MTW worked! which was news to me), you sure you have a visible marker on the map?

Edited by Mattar_Tharkari

Share this post


Link to post
Share on other sites

EDIT: Having said modelToWorld does work, it doesn't for this scenario. Its not independent of the vehicles heading.

Edited by Foxy

Share this post


Link to post
Share on other sites

It works? I must have done something wrong. (misplaced a " or forgot a ;) will check it later on and come back

Share this post


Link to post
Share on other sites

Just to clarify... do you want the marker to always be to the east of the vehicle or do you want it to always be to the right i.e: if the vehicle is facing west the marker will be to the north?

Share this post


Link to post
Share on other sites

independently of where the vehicle is facing, the marker must move to the right (or to the left) of the vehicle, about 5 meters.

Share this post


Link to post
Share on other sites

Mess around with ModelToWorld & see if yields acceptable results.

Share this post


Link to post
Share on other sites

yep! it works! it was my fault, had a stupid sintax error that halted the script.

Thanks all for your help!

Share this post


Link to post
Share on other sites

Sorry for the confusion... independent of the vehicles heading to me means the marker will always be on the right of the vehicle on the map, if the vehicle turned to the west the marker would still be on the right (i.e east) on the map. To me modelToWorld is not independant for a map marker, if the vehicle is facing west the marker is now above or north of the vehicle ... Lol. Either way you have your answer I guess.

Share this post


Link to post
Share on other sites
I guess you could use a BIS function to calculate the position, you would need a functions module on the map if you wanted to use this method.

_markerPos = [vehName, 5, 90] call BIS_fnc_relPos;

That will give you a position 5 meters from the vehicle on a compass bearing of 90.

Hey, this came in really handy for a cutscene I'm doing. Where modeltoworld isn't even a possibility (it seems). Thankyou!

Share this post


Link to post
Share on other sites

I use it a fair bit myself... at least something good came out of my confusion. :)

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  

×