Jump to content
Freghar

Restoring original vectorDir/Up after attachTo

Recommended Posts

Hello,

since attachTo seems to change the coordinate space for setVectorDirAndUp (at least) to be relative to the parent vehicle's direction/up (http://killzonekid.com/arma-scripting-tutorials-attachto-and-setvectordirandup/), how would one go about attaching an object, but keeping its direction/up unchanged w.r.t. global world dir/up?

 

In other words, how to cancel out the dir/up rotation caused by attachTo?

 

I tried something like

/* target: object I'm attaching to, source: object I want to attach */
private _dir = (vectorDir _source vectorDiff vectorDir _target);
private _up = (vectorUp _source vectorDiff vectorUp _target);
_source attachTo [_target];
_source setVectorDirAndUp [_dir, _up];

the idea being that I can substract the target's absolute dir/up from the source's dir/up to get a relative dir/up between the target and the source, to be used after attachTo.

However it doesn't seem to work as the source object just becomes flipped on its side, for some reason.

 

Can anybody please see what I missed?

 

Thanks.

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

×