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


C# Vector3.Validate方法代码示例

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


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

示例1: CompoundShapeEntry

 ///<summary>
 /// Constructs a new compound shape entry using the volume of the shape as a weight.
 ///</summary>
 ///<param name="shape">Shape to use.</param>
 ///<param name="position">Local position of the shape.</param>
 ///<param name="weight">Weight of the entry.  This defines how much the entry contributes to its owner
 /// for the purposes of center of mass and inertia computation.</param>
 public CompoundShapeEntry(EntityShape shape, Vector3 position, float weight)
 {
     position.Validate();
     LocalTransform = new RigidTransform(position);
     Shape = shape;
     Weight = weight;
 }
开发者ID:dsmo7206,项目名称:Lemma,代码行数:14,代码来源:CompoundShape.cs

示例2: SetPosition

 protected void SetPosition(Vector3 position)
 {
     position.Validate();
     this.Position = position;
     ResetViewMatrix();
 }
开发者ID:sytelus,项目名称:StartTrek,代码行数:6,代码来源:Object3D.cs

示例3: ComputeCenter

        /// <summary>
        /// Computes the center of the shape.  This can be considered its 
        /// center of mass, based on the weightings of entries in the shape.
        /// For properly calibrated compound shapes, this will return a zero vector,
        /// since the shape recenters itself on construction.
        /// </summary>
        /// <returns>Center of the shape.</returns>
        public override Vector3 ComputeCenter()
        {
            float totalWeight = 0;
            var center = new Vector3();
            for (int i = 0; i < shapes.Count; i++)
            {
                totalWeight += shapes.Elements[i].Weight;
                Vector3 centerContribution;
                Vector3.Multiply(ref shapes.Elements[i].LocalTransform.Position, shapes.Elements[i].Weight, out centerContribution);
                Vector3.Add(ref center, ref centerContribution, out center);

            }
            if (totalWeight <= 0)
                throw new NotFiniteNumberException("Cannot compute center; the total weight of a compound shape must be positive.");
            Vector3.Divide(ref center, totalWeight, out center);
            center.Validate();
            return center;
        }
开发者ID:dsmo7206,项目名称:Lemma,代码行数:25,代码来源:CompoundShape.cs


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