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


C# btVector3.Subtract方法代码示例

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


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

示例1: calculateTemporalAabb

        ///calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep)
	    ///result is conservative
        public void calculateTemporalAabb(btTransform curTrans, btVector3 linvel, btVector3 angvel, float timeStep, out btVector3 temporalAabbMin, out btVector3 temporalAabbMax)
        {
            //start with static aabb
            getAabb(curTrans, out temporalAabbMin, out temporalAabbMax);

            float temporalAabbMaxx = temporalAabbMax.X;
            float temporalAabbMaxy = temporalAabbMax.Y;
            float temporalAabbMaxz = temporalAabbMax.Z;
            float temporalAabbMinx = temporalAabbMin.X;
            float temporalAabbMiny = temporalAabbMin.Y;
            float temporalAabbMinz = temporalAabbMin.Z;

            // add linear motion
            btVector3 linMotion;// = linvel * timeStep;
            btVector3.Multiply(ref linvel, timeStep, out linMotion);
            ///@todo: simd would have a vector max/min operation, instead of per-element access
            if (linMotion.X > 0f)
                temporalAabbMaxx += linMotion.X;
            else
                temporalAabbMinx += linMotion.X;
            if (linMotion.Y > 0f)
                temporalAabbMaxy += linMotion.Y;
            else
                temporalAabbMiny += linMotion.Y;
            if (linMotion.Z > 0f)
                temporalAabbMaxz += linMotion.Z;
            else
                temporalAabbMinz += linMotion.Z;

            //add conservative angular motion
            float angularMotion = angvel.Length * getAngularMotionDisc() * timeStep;
            btVector3 angularMotion3d = new btVector3(angularMotion, angularMotion, angularMotion);
            temporalAabbMin = new btVector3(temporalAabbMinx, temporalAabbMiny, temporalAabbMinz);
            temporalAabbMax = new btVector3(temporalAabbMaxx, temporalAabbMaxy, temporalAabbMaxz);

            //temporalAabbMin -= angularMotion3d;
            //temporalAabbMax += angularMotion3d;
            temporalAabbMin.Subtract(ref angularMotion3d);
            temporalAabbMax.Add(ref angularMotion3d);
        }
开发者ID:himapo,项目名称:ccm,代码行数:42,代码来源:CollisionShape.cs


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