本文整理汇总了C#中VRageMath.LengthSquared方法的典型用法代码示例。如果您正苦于以下问题:C# VRageMath.LengthSquared方法的具体用法?C# VRageMath.LengthSquared怎么用?C# VRageMath.LengthSquared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VRageMath
的用法示例。
在下文中一共展示了VRageMath.LengthSquared方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetListenerLocation
void GetListenerLocation(ref VRageMath.Vector3 position, ref VRageMath.Vector3 up, ref VRageMath.Vector3 forward)
{
// NOTICE: up vector is reverted, don't know why, I still have to investigate it
if (MySession.LocalHumanPlayer != null && MySession.LocalHumanPlayer.Character != null)
{
position = MySession.LocalHumanPlayer.Character.WorldMatrix.Translation;
up = -MySession.LocalHumanPlayer.Character.WorldMatrix.Up;
forward = MySession.LocalHumanPlayer.Character.WorldMatrix.Forward;
}
else
if (MySector.MainCamera != null)
{
position = MySector.MainCamera.Position;
up = -MySector.MainCamera.UpVector;
forward = MySector.MainCamera.ForwardVector;
}
const float epsilon = 0.00001f;
Debug.Assert(up.Dot(forward) < epsilon && Math.Abs(up.LengthSquared() - 1) < epsilon && Math.Abs(forward.LengthSquared() - 1) < epsilon, "Invalid direction vectors for audio");
}
示例2: GetListenerLocation
void GetListenerLocation(ref VRageMath.Vector3 position, ref VRageMath.Vector3 up, ref VRageMath.Vector3 forward)
{
// NOTICE: up vector is reverted, don't know why, I still have to investigate it
if (MySector.MainCamera != null)
{
if (MySession.Static != null && MySession.Static.LocalCharacter != null && MySession.Static.CameraController == MySession.Static.LocalCharacter)
position = MySession.Static.LocalCharacter.PositionComp.GetPosition();
else
position = MySector.MainCamera.Position;
// PARODY
up = -Vector3D.Normalize(MySector.MainCamera.UpVector);
forward = Vector3D.Normalize(MySector.MainCamera.ForwardVector);
}
const float epsilon = 0.00005f;
Debug.Assert(up.Dot(forward) < epsilon && Math.Abs(up.LengthSquared() - 1) < epsilon && Math.Abs(forward.LengthSquared() - 1) < epsilon, "Invalid direction vectors for audio");
}