Pointer above the car
#8

how about this one;
found it in an old missile launcher script

Код:
stock SetObjectToFaceCords(objectid, Float:x1, Float:y1, Float:z1)
{

	new Float:x2,Float:y2,Float:z2;
	GetObjectPos(objectid, x2,y2,z2);

	new Float:DX = floatabs(x2-x1);
	new Float:DY = floatabs(y2-y1);
	new Float:DZ = floatabs(z2-z1);

    new Float:yaw = 0;
    new Float:pitch = 0;

	if(DY == 0 || DX == 0)
	{
	    if(DY == 0 && DX > 0) {
			yaw = 00;
			pitch = 0; }
		else if(DY == 0 && DX < 0) {
			yaw = 180;
			pitch = 180; }
		else if(DY > 0 && DX == 0)  {
			yaw = 90;
			pitch = 90; }
		else if(DY < 0 && DX == 0) {
			yaw = 270;
			pitch = 270; }
		else if(DY == 0 && DX == 0) {
			yaw = 0;
			pitch = 0; }
	}
	else
	{
		yaw = atan(DX/DY);
		pitch = atan(floatsqroot(DX*DX + DZ*DZ) / DY);
		if(x1 > x2 && y1 <= y2) {
		    yaw = yaw + 90;
			pitch = pitch - 45; }
        else if(x1 <= x2 && y1 < y2) {
		    yaw = 90 - yaw;
			pitch = pitch - 45; }
        else if(x1 < x2 && y1 >= y2) {
		    yaw = yaw - 90;
			pitch = pitch - 45; }
        else if(x1 >= x2 && y1 > y2) {
		    yaw = 270 - yaw;
			pitch = pitch + 315; }
        if(z1 < z2)
		    pitch = 360-pitch;
	}
	SetObjectRot(objectid, 0, 0, yaw);
	SetObjectRot(objectid, 0, pitch, yaw+90);
}
Reply


Messages In This Thread
Pointer above the car - by Nameless303 - 21.09.2010, 19:37
Re: Pointer above the car - by Voldemort - 21.09.2010, 20:54
Re: Pointer above the car - by Nameless303 - 21.09.2010, 21:38
AW: Re: Pointer above the car - by Nero_3D - 21.09.2010, 21:45
Re: AW: Re: Pointer above the car - by Nameless303 - 22.09.2010, 12:34
Re: Pointer above the car - by Nameless303 - 22.09.2010, 21:18
Re: Pointer above the car - by Steven82 - 22.09.2010, 22:03
Re: Pointer above the car - by boelie - 23.09.2010, 06:59
Re: Pointer above the car - by Nameless303 - 24.09.2010, 22:34

Forum Jump:


Users browsing this thread: 1 Guest(s)