SA-MP Forums Archive
OBJECT FACING POS [ L00K ] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OBJECT FACING POS [ L00K ] (/showthread.php?tid=290444)



OBJECT FACING POS [ L00K ] - Kyle - 15.10.2011

How can I get the object to face the next object?



If I have the x,y,z of the next object, what axis to I take to set the rot on the previous object to face the next?

Thanks

Kyle


Re: OBJECT FACING POS [ L00K ] - Kingunit - 15.10.2011





Re: OBJECT FACING POS [ L00K ] - Kyle - 15.10.2011

Quote:
Originally Posted by ******
Посмотреть сообщение
You need to set the z rotation (yaw).
This screenie is with only the Y rot set:



As you can see some are correct pre done, but even if I do set the Z, it's going to be out again where others will be fine and others not as if I use like SetObjectFacingPos it makes them all go wacky.


Re: OBJECT FACING POS [ L00K ] - Kayaque - 15.10.2011

New Float, Float:y, Float:z; GetPlayerPos(playerid, x, y, z);
New Float:a, GetPlayerFactingAngle(playerid, a);
CreateObject(objid, x, y, z, a..);


Re: OBJECT FACING POS [ L00K ] - Kyle - 15.10.2011

Quote:
Originally Posted by ******
Посмотреть сообщение
That could be something to do with this:

http://forum.sa-mp.com/showthread.ph...12#post1459812
How can this be fixed?


Re: OBJECT FACING POS [ L00K ] - JernejL - 15.10.2011

some objects by default don't point in 0 angle on z axis, so you need to adjust all axes properly..


Re: OBJECT FACING POS [ L00K ] - Kyle - 15.10.2011

Quote:
Originally Posted by JernejL
Посмотреть сообщение
some objects by default don't point in 0 angle on z axis, so you need to adjust all axes properly..
But how should I know the angles and how to calculate them when I'm not a mathmatical genius.


Re: OBJECT FACING POS [ L00K ] - Kyle - 16.10.2011

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
This screenie is with only the Y rot set:



As you can see some are correct pre done, but even if I do set the Z, it's going to be out again where others will be fine and others not as if I use like SetObjectFacingPos it makes them all go wacky.
Guys, is there a way to check where the next arrow is heading, so, if the next arrow is infront face it infront, or if its going to the left face it left?


Re: OBJECT FACING POS [ L00K ] - Kyle - 16.10.2011



That image is with NO rotational axis being set, the image below sets the Z rotational angle using this function:

http://pastie.org/2705005

When that function is used to face the node to the next one this what happens, some work some don't:



I need a way to only do certain ones, maybe like check if the next node is going left, right, up or down. Then decide where to face?


Re: OBJECT FACING POS [ L00K ] - Lorenc_ - 16.10.2011

Check the useful functions topic, on page 256 you'll see my function or on 257-268 you'll see ryders (I recommend ryders)