Vehicle Matrix - Complex Math
#1

I'm using Gamer_Z's code but it only has this:

stock PositionFromVehicleOffset(vehicle,Float:offX,Float :offY,Float:offZ,&Float:x,&Float:y,&Float:z)

I need the oposit to this function, I need to get the Vehicle Offset FROM Position, not the other way around.

Can anyone help me please?

The code is:

Код:
stock PositionFromVehicleOffset(vehicle,Float:offX,Float:offY,Float:offZ,&Float:x,&Float:y,&Float:z)
{
//initial processing step - gather information
	new
		Mat4x3[MatrixParts][MatrixIndicator];

    GetVehicleMatrix(vehicle,Mat4x3);

//offset calculation math
	x = offX * Mat4x3[mp_PITCH][mi_X] + offY * Mat4x3[mp_ROLL][mi_X] + offZ * Mat4x3[mp_YAW][mi_X] + Mat4x3[mp_POS][mi_X];
	y = offX * Mat4x3[mp_PITCH][mi_Y] + offY * Mat4x3[mp_ROLL][mi_Y] + offZ * Mat4x3[mp_YAW][mi_Y] + Mat4x3[mp_POS][mi_Y];
	z = offX * Mat4x3[mp_PITCH][mi_Z] + offY * Mat4x3[mp_ROLL][mi_Z] + offZ * Mat4x3[mp_YAW][mi_Z] + Mat4x3[mp_POS][mi_Z];

	return 1;
}
The include is here: http://gpb.******code.com/svn/trunk/...icleMatrix.inc

Regards
Reply


Messages In This Thread
Vehicle Matrix - Complex Math - by Kyle - 06.01.2014, 21:14
AW: Vehicle Matrix - Complex Math - by Nero_3D - 07.01.2014, 16:29
Re: AW: Vehicle Matrix - Complex Math - by Kyle - 07.01.2014, 19:23

Forum Jump:


Users browsing this thread: 1 Guest(s)