public static idAngles ToAngles(this Matrix m) { float sp = m.M13; // cap off our sin value so that we don't get any NANs if (sp > 1.0f) { sp = 1.0f; } else if (sp < -1.0f) { sp = -1.0f; } double theta = -System.Math.Asin(sp); double cp = System.Math.Cos(theta); idAngles angles = new idAngles(); if (cp > (8192.0f * idMath.Epsilon)) { angles.Pitch = MathHelper.ToDegrees((float)theta); angles.Yaw = MathHelper.ToDegrees(idMath.Atan2(m.M12, m.M11)); angles.Roll = MathHelper.ToDegrees(idMath.Atan2(m.M23, m.M33)); } else { angles.Pitch = MathHelper.ToDegrees((float)theta); angles.Yaw = MathHelper.ToDegrees(-idMath.Atan2(m.M21, m.M22)); angles.Roll = 0; } return(angles); }
public override void Teleport(Vector3 origin, idAngles angles, idEntity destination) { if (this.Disposed == true) { throw new ObjectDisposedException(this.GetType().Name); } idConsole.Warning("TODO: idActor.Teleport"); }