Exemplo n.º 1
0
//this will generate the orientation to use for a piece of debris
LTRotation CDebrisSystemFX::GenerateObjectSpaceDebrisRot(const LTVector& vObjSpacePos, const LTVector& vObjSpaceVel)
{
	switch(GetProps()->m_eOrientationType)
	{
	case eDebrisOrientation_Random:
		return ConvertDirectionToOrientation(GenerateRandomUnitVector());
		break;

	case eDebrisOrientation_Position:
		if(vObjSpacePos == LTVector::GetIdentity())
		{
			return LTRotation::GetIdentity();
		}
		else
		{
			return ConvertDirectionToOrientation(vObjSpacePos.GetUnit());
		}
		break;

	case eDebrisOrientation_Parent:
		return LTRotation::GetIdentity();
		break;

	case eDebrisOrientation_Velocity:
		if(vObjSpaceVel == LTVector::GetIdentity())
		{
			return LTRotation::GetIdentity();
		}
		else
		{
			return ConvertDirectionToOrientation(vObjSpaceVel.GetUnit());
		}
		break;

	default:
		LTERROR("Warning: Invalid debris system rotation type specified");
		return LTRotation::GetIdentity();
		break;
	}
}