Exemple #1
0
// --------------------------------------------------------------------------
//Does the actual rotation
bool psLinearMovement::RotateV (float delta)
{
  if (!mesh)
  {
    return false;
  }

  // rotation
  if (angularVelocity < SMALL_EPSILON)
    return false;

  csVector3 angle = angularVelocity * delta;
  if (angleToReachFlag)
  {
    float current_yrot = GetYRotation();
    float yrot_delta = fabs (angleToReach.y - current_yrot);
    if (fabs(angle.y) > yrot_delta)
    {
      angle.y = (angle.y / fabs (angle.y)) * yrot_delta;
      angularVelocity = 0;
      angleToReachFlag = false;
    }
  }

  iMovable* movable = mesh->GetMovable ();
  csYRotMatrix3 rotMat (angle.y);
  movable->SetTransform (movable->GetTransform ().GetT2O () * rotMat);
  movable->UpdateMove ();
  //pcmesh->GetMesh ()->GetMovable ()->Transform (rotMat);
  return true;
}
void InverseRotateMatrix(D3DRMMATRIX4D* mat, float fX, float fY, float fZ)
{
	float frot;
	D3DRMMATRIX4D rotmat;

	frot = GetYRotation(fX, fY, fZ);

	MakeYRotatationMatrix(&rotmat, 2*PI - frot);

	PostMultiplyMatrix(mat, &rotmat);
}
Exemple #3
0
void psLinearMovement::GetLastFullPosition (csVector3& pos, float& yrot,
    iSector*& sector)
{
  if (!mesh)  return;

  // Position
  pos = GetFullPosition ();

  // rotation
  yrot = GetYRotation ();

  // Sector
  sector = GetSector ();
}