Exemple #1
0
void FGForce::SetAnglesToBody(double broll, double bpitch, double byaw)
{
  if (ttype == tCustom) {
    vOrient(ePitch) = bpitch;
    vOrient(eRoll) = broll;
    vOrient(eYaw) = byaw;

    UpdateCustomTransformMatrix();
  }
}
Exemple #2
0
void FGForce::UpdateCustomTransformMatrix(void)
{
  double cp,sp,cr,sr,cy,sy;
  double srsp, crcy, crsy;

  cp=cos(vOrient(ePitch)); sp=sin(vOrient(ePitch));
  cr=cos(vOrient(eRoll));  sr=sin(vOrient(eRoll));
  cy=cos(vOrient(eYaw));   sy=sin(vOrient(eYaw));

  srsp = sr*sp;
  crcy = cr*cy;
  crsy = cr*sy;

  mT(1,1) =  cp*cy;
  mT(2,1) =  cp*sy;
  mT(3,1) = -sp;

  mT(1,2) = srsp*cy - crsy;
  mT(2,2) = srsp*sy + crcy;
  mT(3,2) = sr*cp;

  mT(1,3) = crcy*sp + sr*sy;
  mT(2,3) = crsy*sp - sr*cy;
  mT(3,3) = cr*cp;
}
Exemple #3
0
/**
* CActor::setPosition
* @date Modified Mar 07, 2006
*/
D3DXVECTOR3 CActor::getOrientation()
{
	// get the angle of rotation
	D3DXVECTOR3 vOrient(m_ActorMatrix._31, m_ActorMatrix._32, m_ActorMatrix._33);

	// strip the scale out of the orientation
	if(m_vScale.x != 1.0f)
	{
		vOrient.x *= (1.0f/m_vScale.x);
	}
	if(m_vScale.y != 1.0f)
	{
		vOrient.y *= (1.0f/m_vScale.y);
	}
	if(m_vScale.z != 1.0f)
	{
		vOrient.z *= (1.0f/m_vScale.z);
	}

	return vOrient;
}