Jump to content
Sign in to follow this  
CptBBQ

attachTo with current offset

Recommended Posts

Hi there!

I need to be able to attach any two objects to each other, without changing their actual positions. For example, vehicle A is standing in front of static weapon B. B is attached to A, but doesn´t change position. Only if A moves, B moves along.

First thing I tried was this:

_obj attachTo [_target, _target worldToModel (getPos _obj)];

... seemed obvious to me, but didn´t work as expected. The attached objects z-axis-position changes. Most of the time the object disappears underground, but some objects hover above the ground.

I guessed there´s some arbitrary offset build into the worldToModel command. So I tried using the objects original z-position as the vertical offset, but still, most objects are attached above or below their actual z-position.

Has anyone experienced similar problems? Any chance there´s a workaround?

Any help is appreciated!

Cheers,

CptBBQ

PS: I know my example can be solved with different techniques, but for the actual purpose it´s very important that the object remains at it´s exact position when attached.

I never had such problems with attachTo before

Share this post


Link to post
Share on other sites

your making it too complicated

_obj attachTo [_target];

Things will disappear if the original object is moved and the terrain changes.

Edited by F2k Sel
  • Like 1

Share this post


Link to post
Share on other sites

OMG! I didn´t know attachTo would work that way, too... that makes everything so much easier.

Thank you, Sel!

PS: to be fair to myself, the biki doesn´t state that the offset is optional =)

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  

×