nuxil 2 Posted March 21, 2007 If i know the position of A and B, and I know the distance of from A to B.. and i know the heading from A to B, i also know the hight of A and B,, so how can i the set obj A to face "point" at obj B whith eighter setvectorUp or setvectorDir, Share this post Link to post Share on other sites
t_d 47 Posted March 21, 2007 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Pa = getpos A; _Pb = getpos B; _Pab = [(_Pb select 0 - _Pa select 0), (_Pb select 1 - _Pa select 1),(_Pb select 2 - _Pa select 2)]; _objA setVectorDir _Pab; Share this post Link to post Share on other sites
lethal 0 Posted March 21, 2007 since i'm a lazy guy (aren't we all ) and i don't wanna spend hours trying to figure it out i'm gonna follow up on that question with another one: if A and B aren't at the same height, how do i calculate the upvector of A so that i can use setvectorup to make object A point straight at object B (i'm talking pitch here)? basic math, i know, but it's been sooo long Share this post Link to post Share on other sites
nuxil 2 Posted March 21, 2007 I like to know that too.. i know how to get the angel tho.. but not how to use it with vectoup. forexample.. objA = Aax,Aay,Aaz. objB = Bbx,Bby,Bbz. // use this g0 = Bbx,Bby,0 "make a triangle" tan angel = (( Bbz distance g0 ) / ( objA distance objB )) atan angle = angle in deg,, PS.. i whish ther was a "setdir" to Z cordites :P Share this post Link to post Share on other sites
nuxil 2 Posted March 22, 2007 hehe i dont get it im still as confused as i was.. Code Sample _Pa = getpos A; _Pb = getpos B; _Pab = [(_Pb select 0 - _Pa select 0), (_Pb select 1 - _Pa select 1),(_Pb select 2 - _Pa select 2)]; _objA setVectorDir _Pab; kinda worked. but if i changed it to setVectorUp _Pab instead.. i got better results.. obj B faces me in "xyz" cords..VS setVectorDir that only seems x.y,z where z=speed up/down with the objects current rotation "vectopup" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _testobj = "LODy_test" createVehicle [0,0,0]; _testobj setpos [(getpos player select 0),(getpos player select 1), ((getpos player select 2)+50)]; while {true} do { _Pa = getpos _testobj; _Pb = getpos player; _Pab = [(_Pb select 0 - _Pa select 0), (_Pb select 1 - _Pa select 1),(_Pb select 2 - _Pa select 2)]; _testobj setVectorUp _Pab; sleep 0.1; }; on your player put nil = this execvm "weirdstuff.sqf" take a ride around it with a heli Share this post Link to post Share on other sites
UNN 0 Posted March 22, 2007 This covers the basics: http://www.flashpoint1985.com/cgi-bin....ectorup Share this post Link to post Share on other sites