当前位置: 首页>>代码示例>>C#>>正文


C# UnityEngine.Normalize方法代码示例

本文整理汇总了C#中UnityEngine.Normalize方法的典型用法代码示例。如果您正苦于以下问题:C# UnityEngine.Normalize方法的具体用法?C# UnityEngine.Normalize怎么用?C# UnityEngine.Normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine的用法示例。


在下文中一共展示了UnityEngine.Normalize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateFrame

 public bool CreateFrame(UnityEngine.Vector3 forward, UnityEngine.Vector3 up, UnityEngine.Vector3 constraintPoint, ref BulletSharp.Math.Matrix m, ref string errorMsg)
 {
     BulletSharp.Math.Vector4 x;
     BulletSharp.Math.Vector4 y;
     BulletSharp.Math.Vector4 z;
     if (forward == Vector3.zero)
     {
         errorMsg = "forward vector must not be zero";
         return false;
     }
     forward.Normalize();
     if (up == Vector3.zero)
     {
         errorMsg = "up vector must not be zero";
         return false;
     }
     Vector3 right = Vector3.Cross(forward, up);
     if (right == Vector3.zero)
     {
         errorMsg = "forward and up vector must not be colinear";
         return false;
     }
     up = Vector3.Cross(right, forward);
     right.Normalize();
     up.Normalize();
     x.X = forward.x; x.Y = forward.y; x.Z = forward.z; x.W = 0f;
     y.X = up.x; y.Y = up.y; y.Z = up.z; y.W = 0f;
     z.X = right.x; z.Y = right.y; z.Z = right.z; z.W = 0f;
     m.Row1 = x;
     m.Row2 = y;
     m.Row3 = z;
     m.Origin = constraintPoint.ToBullet();
     return true;
 }
开发者ID:Cyberbanan,项目名称:BulletSharpUnity3d,代码行数:34,代码来源:BTypedConstraint.cs


注:本文中的UnityEngine.Normalize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。