Jump to content
Sign in to follow this  
celery

setPos formula needed

Recommended Posts

Can anyone supply me with a formula to setpos object1 two meters to the right of object2's position regardless of object2's azimuth? I'm having trouble finding out how to "anchor" the setpos coordinates to an object's vector.

Share this post


Link to post
Share on other sites

i think you need modeltoworld

relpos = [0,2,0]

worldpos = object1 modeltoworld relpos

object2 setpos worldpos

object2 setdir getdir object1

not sure on [0,2,0] could be -2

have a mess with it

Share this post


Link to post
Share on other sites

no problem with azimuts ...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_dst=2;

_pos=getpos obj1;

_dir=(getdir obj1)-90;

_dpos=[(_pos select 0)+(sin _dir)*_dst,(_pos select 1)+(cos _dir)*_dst,0];

should work, but not tested...

Share this post


Link to post
Share on other sites
i think you need modeltoworld

relpos = [0,2,0]

worldpos = object1 modeltoworld relpos

object2 setpos worldpos

object2 setdir  getdir object1

not sure on [0,2,0] could be -2

have a mess with it

sry to correct you but the right side should be [2,0,0] wink_o.gif

Remember [+EAST/-WEST , +NORTH/-SOUTH , +UP/-DOWN] :P

Share this post


Link to post
Share on other sites
Quote[/b] ]Remember [+EAST/-WEST , +NORTH/-SOUTH , +UP/-DOWN]

it will be my next tattoo wink_o.gif

thanks for correcting

Share this post


Link to post
Share on other sites

Easiest way to remember that for me goes like this:

The origin ([0,0,0]) is sea level on the bottom left corner of the map. X is almost always left, right on a cartesian plane.

That may or may not help you.

Share this post


Link to post
Share on other sites
Easiest way to remember that for me goes like this:

The origin ([0,0,0]) is sea level on the bottom left corner of the map. X is almost always left, right on a cartesian plane.

That may or may not help you.

i got lost at sea level smile_o.gif

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  

×