• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LinearMath.IndexedQuaternion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BulletXNA.LinearMath.IndexedQuaternion的典型用法代码示例。如果您正苦于以下问题:C# IndexedQuaternion类的具体用法?C# IndexedQuaternion怎么用?C# IndexedQuaternion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IndexedQuaternion类属于BulletXNA.LinearMath命名空间,在下文中一共展示了IndexedQuaternion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: IndexedBasisMatrix

 public IndexedBasisMatrix(ref IndexedQuaternion q)
 {
     float d = q.LengthSquared();
     Debug.Assert(d != 0.0f);
     float s = 2.0f / d;
     float xs = q.X * s, ys = q.Y * s, zs = q.Z * s;
     float wx = q.W * xs, wy = q.W * ys, wz = q.W * zs;
     float xx = q.X * xs, xy = q.X * ys, xz = q.X * zs;
     float yy = q.Y * ys, yz = q.Y * zs, zz = q.Z * zs;
     _el0 = new IndexedVector3(1.0f - (yy + zz), xy - wz, xz + wy);
     _el1 = new IndexedVector3(xy + wz, 1.0f - (xx + zz), yz - wx);
     _el2 = new IndexedVector3(xz - wy, yz + wx, 1.0f - (xx + yy));
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:13,代码来源:IndexedBasisMatrix.cs


示例2: IntegrateTransform

	    public static void IntegrateTransform(ref IndexedMatrix curTrans,ref IndexedVector3 linvel,ref IndexedVector3 angvel,float timeStep,out IndexedMatrix predictedTransform)
	    {
            predictedTransform = IndexedMatrix.CreateTranslation(curTrans._origin + linvel * timeStep);
    //	#define QUATERNION_DERIVATIVE
	    #if QUATERNION_DERIVATIVE
            IndexedVector3 pos;
            IndexedQuaternion predictedOrn;
            IndexedVector3 scale;

            curTrans.Decompose(ref scale, ref predictedOrn, ref pos);


		    predictedOrn += (angvel * predictedOrn) * (timeStep * .5f));
		    predictedOrn.Normalize();
        #else
            //Exponential map
		    //google for "Practical Parameterization of Rotations Using the Exponential Map", F. Sebastian Grassia

		    IndexedVector3 axis;
		    float	fAngle = angvel.Length(); 
		    //limit the angular motion
		    if (fAngle*timeStep > ANGULAR_MOTION_THRESHOLD)
		    {
			    fAngle = ANGULAR_MOTION_THRESHOLD / timeStep;
		    }

		    if ( fAngle < 0.001f )
		    {
			    // use Taylor's expansions of sync function
			    axis   = angvel*( 0.5f*timeStep-(timeStep*timeStep*timeStep)*(0.020833333333f)*fAngle*fAngle );
		    }
		    else
		    {
			    // sync(fAngle) = sin(c*fAngle)/t
			    axis   = angvel*( (float)Math.Sin(0.5f*fAngle*timeStep)/fAngle );
		    }
		    IndexedQuaternion dorn = new IndexedQuaternion(axis.X,axis.Y,axis.Z,(float)Math.Cos( fAngle*timeStep*.5f) );

            IndexedQuaternion orn0 = curTrans.GetRotation();

		    IndexedQuaternion predictedOrn = dorn * orn0;
		    predictedOrn.Normalize();
	    #endif

            IndexedMatrix newMatrix = IndexedMatrix.CreateFromQuaternion(predictedOrn);
            predictedTransform._basis = newMatrix._basis;
	    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:47,代码来源:TransformUtil.cs


示例3: SetFrames

    //SetFrames(m_constraint.ptr, frameA, frameArot, frameB, frameBrot);
    public override bool SetFrames(BulletConstraint pConstraint, Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot)
    {
        Generic6DofConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofConstraint;
        IndexedVector3 frame1v = new IndexedVector3(pframe1.X, pframe1.Y, pframe1.Z);
        IndexedQuaternion frame1rot = new IndexedQuaternion(pframe1rot.X, pframe1rot.Y, pframe1rot.Z, pframe1rot.W);
        IndexedMatrix frame1 = IndexedMatrix.CreateFromQuaternion(frame1rot);
        frame1._origin = frame1v;

        IndexedVector3 frame2v = new IndexedVector3(pframe2.X, pframe2.Y, pframe2.Z);
        IndexedQuaternion frame2rot = new IndexedQuaternion(pframe2rot.X, pframe2rot.Y, pframe2rot.Z, pframe2rot.W);
        IndexedMatrix frame2 = IndexedMatrix.CreateFromQuaternion(frame2rot);
        frame2._origin = frame2v;
        constraint.SetFrames(ref frame1, ref frame2);
        return true;
    }
开发者ID:CassieEllen,项目名称:opensim,代码行数:16,代码来源:BSAPIXNA.cs


示例4: SetTranslation

    public override void SetTranslation(BulletBody pCollisionObject, Vector3 _position, Quaternion _orientation)
    {
        CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
        IndexedVector3 vposition = new IndexedVector3(_position.X, _position.Y, _position.Z);
        IndexedQuaternion vquaternion = new IndexedQuaternion(_orientation.X, _orientation.Y, _orientation.Z,
                                                              _orientation.W);
        IndexedMatrix mat = IndexedMatrix.CreateFromQuaternion(vquaternion);
        mat._origin = vposition;
        collisionObject.SetWorldTransform(mat);

    }
开发者ID:CassieEllen,项目名称:opensim,代码行数:11,代码来源:BSAPIXNA.cs


示例5: Create6DofSpringConstraint

    public override BulletConstraint Create6DofSpringConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2,
                                    Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot,
                                    bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies)

    {
        Generic6DofSpringConstraint constrain = null;
        DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
        RigidBody body1 = (pBody1 as BulletBodyXNA).rigidBody;
        RigidBody body2 = (pBody2 as BulletBodyXNA).rigidBody;
        if (body1 != null && body2 != null)
        {
            IndexedVector3 frame1v = new IndexedVector3(pframe1.X, pframe1.Y, pframe1.Z);
            IndexedQuaternion frame1rot = new IndexedQuaternion(pframe1rot.X, pframe1rot.Y, pframe1rot.Z, pframe1rot.W);
            IndexedMatrix frame1 = IndexedMatrix.CreateFromQuaternion(frame1rot);
            frame1._origin = frame1v;

            IndexedVector3 frame2v = new IndexedVector3(pframe2.X, pframe2.Y, pframe2.Z);
            IndexedQuaternion frame2rot = new IndexedQuaternion(pframe2rot.X, pframe2rot.Y, pframe2rot.Z, pframe2rot.W);
            IndexedMatrix frame2 = IndexedMatrix.CreateFromQuaternion(frame2rot);
            frame2._origin = frame1v;

            constrain = new Generic6DofSpringConstraint(body1, body2, ref frame1, ref frame2, puseLinearReferenceFrameA);
            world.AddConstraint(constrain, pdisableCollisionsBetweenLinkedBodies);

            constrain.CalculateTransforms();
        }

        return new BulletConstraintXNA(constrain);
    }
开发者ID:CassieEllen,项目名称:opensim,代码行数:29,代码来源:BSAPIXNA.cs


示例6: SetMotorTarget

		public void SetMotorTarget(ref IndexedQuaternion qAinB, float dt) // qAinB is rotation of body A wrt body B.
		{
			// convert target from body to constraint space
            IndexedQuaternion qConstraint = MathUtil.QuaternionInverse(m_rbBFrame.GetRotation())* qAinB * m_rbAFrame.GetRotation();

            qConstraint.Normalize();

			// extract "pure" hinge component
			IndexedVector3 vNoHinge = MathUtil.QuatRotate(ref qConstraint, ref vHinge);
			vNoHinge.Normalize();
			IndexedQuaternion qNoHinge = MathUtil.ShortestArcQuat(ref vHinge, ref vNoHinge);
			IndexedQuaternion qHinge = MathUtil.QuaternionInverse(ref qNoHinge) * qConstraint;
			qHinge.Normalize();

			// compute angular target, clamped to limits
			float targetAngle = MathUtil.QuatAngle(ref qHinge);

			if (targetAngle > MathUtil.SIMD_PI) // long way around. flip quat and recalculate.
			{
				qHinge = -qHinge;
				targetAngle = MathUtil.QuatAngle(ref qHinge);
			}
			if (qHinge.Z < 0)
			{
				targetAngle = -targetAngle;
			}

			SetMotorTarget(targetAngle, dt);

		}
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:30,代码来源:HingeConstraint.cs


示例7: Dot

 public static float Dot(IndexedQuaternion q, IndexedQuaternion q2)
 {
     return q.X * q2.X + q.Y * q2.Y + q.Z * q2.Z + q.W * q2.W;
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:4,代码来源:IndexedQuaternion.cs


示例8: Inverse

 public static IndexedQuaternion Inverse(IndexedQuaternion q)
 {
     return new IndexedQuaternion(-q.X, -q.Y, -q.Z, q.W);
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:4,代码来源:IndexedQuaternion.cs


示例9: AlmostEqual

 internal static bool AlmostEqual(ref IndexedQuaternion v1, ref IndexedQuaternion v2, float nEpsilon)
 {
     return
     (((v1.X - nEpsilon) < v2.X) && (v2.X < (v1.X + nEpsilon))) &&
     (((v1.Y - nEpsilon) < v2.Y) && (v2.Y < (v1.Y + nEpsilon))) &&
     (((v1.Z - nEpsilon) < v2.Z) && (v2.Z < (v1.Z + nEpsilon))) &&
     (((v1.W - nEpsilon) < v2.W) && (v2.W < (v1.W + nEpsilon)));
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:8,代码来源:SimMotionState.cs


示例10: InitSeparatingDistance

        void InitSeparatingDistance(ref IndexedVector3 separatingVector, float separatingDistance, ref IndexedMatrix transA, ref IndexedMatrix transB)
	    {
		    m_separatingNormal = separatingVector;
		    m_separatingDistance = separatingDistance;
    		
		    IndexedVector3 toPosA = transA._origin;
		    IndexedVector3 toPosB = transB._origin;
            IndexedQuaternion toOrnA = transA.GetRotation();
            IndexedQuaternion toOrnB = transB.GetRotation();
		    m_posA = toPosA;
		    m_posB = toPosB;
		    m_ornA = toOrnA;
		    m_ornB = toOrnB;
	    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:14,代码来源:TransformUtil.cs


示例11: UpdateSeparatingDistance

        public void UpdateSeparatingDistance(ref IndexedMatrix transA, ref IndexedMatrix transB)
        {
            IndexedVector3 toPosA = transA._origin;
            IndexedVector3 toPosB = transB._origin;
            IndexedQuaternion toOrnA = transA.GetRotation();
            IndexedQuaternion toOrnB = transB.GetRotation();

            if (m_separatingDistance > 0.0f)
            {
                IndexedVector3 linVelA;
                IndexedVector3 angVelA;
                IndexedVector3 linVelB;
                IndexedVector3 angVelB;

                TransformUtil.CalculateVelocityQuaternion(ref m_posA, ref toPosA, ref m_ornA, ref toOrnA, 1f, out linVelA, out angVelA);
                TransformUtil.CalculateVelocityQuaternion(ref m_posB, ref toPosB, ref m_ornB, ref toOrnB, 1f, out linVelB, out angVelB);
                float maxAngularProjectedVelocity = angVelA.Length() * m_boundingRadiusA + angVelB.Length() * m_boundingRadiusB;
                IndexedVector3 relLinVel = (linVelB - linVelA);
                float relLinVelocLength = IndexedVector3.Dot((linVelB - linVelA), m_separatingNormal);
                if (relLinVelocLength < 0f)
                {
                    relLinVelocLength = 0f;
                }

                float projectedMotion = maxAngularProjectedVelocity + relLinVelocLength;
                m_separatingDistance -= projectedMotion;
            }

            m_posA = toPosA;
            m_posB = toPosB;
            m_ornA = toOrnA;
            m_ornB = toOrnB;
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:33,代码来源:TransformUtil.cs


示例12: GetRotation

 public static void GetRotation(ref IndexedBasisMatrix a, out IndexedQuaternion rot)
 {
     rot = a.GetRotation();
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:4,代码来源:TransformUtil.cs


示例13: CalculateDiffAxisAngleQuaternion

        public static void CalculateDiffAxisAngleQuaternion(ref IndexedQuaternion orn0, ref IndexedQuaternion orn1a, out IndexedVector3 axis, out float angle)
        {
            IndexedQuaternion orn1 = MathUtil.QuatFurthest(ref orn0, ref orn1a);
            IndexedQuaternion dorn = orn1 * MathUtil.QuaternionInverse(ref orn0);

            ///floating point inaccuracy can lead to w component > 1..., which breaks 
            dorn.Normalize();
            angle = MathUtil.QuatAngle(ref dorn);
            axis = new IndexedVector3(dorn.X, dorn.Y, dorn.Z);

            //check for axis length
            float len = axis.LengthSquared();
            if (len < MathUtil.SIMD_EPSILON * MathUtil.SIMD_EPSILON)
            {
                axis = new IndexedVector3(1f, 0, 0);
            }
            else
            {
                axis.Normalize();
            }
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:21,代码来源:TransformUtil.cs


示例14: CalculateVelocityQuaternion

 public static void CalculateVelocityQuaternion(ref IndexedVector3 pos0, ref IndexedVector3 pos1, ref IndexedQuaternion orn0, ref IndexedQuaternion orn1, float timeStep, out IndexedVector3 linVel, out IndexedVector3 angVel)
 {
     linVel = (pos1 - pos0) / timeStep;
     if (orn0 != orn1)
     {
         IndexedVector3 axis;
         float angle;
         CalculateDiffAxisAngleQuaternion(ref orn0, ref orn1, out axis, out angle);
         angVel = axis * (angle / timeStep);
     }
     else
     {
         angVel = IndexedVector3.Zero;
     }
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:15,代码来源:TransformUtil.cs


示例15: AdjustInternalEdgeContacts


//.........这里部分代码省略.........
            }

#if BT_INTERNAL_EDGE_DEBUG_DRAW
            IndexedVector3 upfix = tri_normal * new IndexedVector3(0.1f, 0.1f, 0.1f);
            DebugDrawLine(tr * v0 + upfix, tr * v1 + upfix, red);
#endif
            if (Math.Abs(info.m_edgeV0V1Angle) < triangleInfoMapPtr.m_maxEdgeAngleThreshold)
            {
#if BT_INTERNAL_EDGE_DEBUG_DRAW
                DebugDrawLine(tr * contact, tr * (contact + cp.m_normalWorldOnB * 10), black);
#endif
                float len = (contact - nearest).Length();
                if (len < triangleInfoMapPtr.m_edgeDistanceThreshold)
                    if (bestedge == 0)
                    {
                        IndexedVector3 edge = (v0 - v1);
                        isNearEdge = true;

                        if (info.m_edgeV0V1Angle == 0.0f)
                        {
                            numConcaveEdgeHits++;
                        }
                        else
                        {

                            bool isEdgeConvex = (info.m_flags & TriangleInfoMap.TRI_INFO_V0V1_CONVEX) != 0;
                            float swapFactor = isEdgeConvex ? 1.0f : -1.0f;
#if BT_INTERNAL_EDGE_DEBUG_DRAW
                            DebugDrawLine(tr * nearest, tr * (nearest + swapFactor * tri_normal * 10), white);
#endif //BT_INTERNAL_EDGE_DEBUG_DRAW

                            IndexedVector3 nA = swapFactor * tri_normal;

                            IndexedQuaternion orn = new IndexedQuaternion(edge, info.m_edgeV0V1Angle);
                            IndexedVector3 computedNormalB = MathUtil.QuatRotate(ref orn, ref tri_normal);
                            if ((info.m_flags & TriangleInfoMap.TRI_INFO_V0V1_SWAP_NORMALB) != 0)
                            {
                                computedNormalB *= -1;
                            }
                            IndexedVector3 nB = swapFactor * computedNormalB;

                            float NdotA = localContactNormalOnB.Dot(ref nA);
                            float NdotB = localContactNormalOnB.Dot(ref nB);
                            bool backFacingNormal = (NdotA < triangleInfoMapPtr.m_convexEpsilon) && (NdotB < triangleInfoMapPtr.m_convexEpsilon);

#if DEBUG_INTERNAL_EDGE
                            {

                                DebugDrawLine(cp.GetPositionWorldOnB(), cp.GetPositionWorldOnB() + tr._basis * (nB * 20), red);
                            }
#endif //DEBUG_INTERNAL_EDGE


                            if (backFacingNormal)
                            {
                                numConcaveEdgeHits++;
                            }
                            else
                            {
                                numConvexEdgeHits++;
                                IndexedVector3 clampedLocalNormal;
                                bool isClamped = ClampNormal(edge, swapFactor * tri_normal, localContactNormalOnB, info.m_edgeV0V1Angle, out clampedLocalNormal);
                                if (isClamped)
                                {
                                    if (((normalAdjustFlags & InternalEdgeAdjustFlags.BT_TRIANGLE_CONVEX_DOUBLE_SIDED) != 0) || (clampedLocalNormal.Dot(frontFacing * tri_normal) > 0))
                                    {
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:67,代码来源:InternalEdgeUtility.cs


示例16: ProcessTriangle


//.........这里部分代码省略.........
                                if (IndexedVector3.Dot(edgeCrossB, tmp) < 0)
                                {
                                    edgeCrossB *= -1;
                                }
                            }

                            float angle2 = 0;
                            float ang4 = 0.0f;

                            IndexedVector3 calculatedEdge = IndexedVector3.Cross(edgeCrossA, edgeCrossB);
                            float len2 = calculatedEdge.LengthSquared();

                            float correctedAngle = 0f;
                            IndexedVector3 calculatedNormalB = normalA;
                            bool isConvex = false;

                            if (len2 < m_triangleInfoMap.m_planarEpsilon)
                            {
                                angle2 = 0.0f;
                                ang4 = 0.0f;
                            }
                            else
                            {
                                calculatedEdge.Normalize();
                                IndexedVector3 calculatedNormalA = IndexedVector3.Cross(calculatedEdge, edgeCrossA);
                                calculatedNormalA.Normalize();
                                angle2 = GetAngle(ref calculatedNormalA, ref edgeCrossA, ref edgeCrossB);
                                ang4 = MathUtil.SIMD_PI - angle2;
                                float dotA = IndexedVector3.Dot(normalA, edgeCrossB);
                                ///@todo: check if we need some epsilon, due to floating point imprecision
                                isConvex = (dotA < 0f);

                                correctedAngle = isConvex ? ang4 : -ang4;
                                IndexedQuaternion orn2 = new IndexedQuaternion(calculatedEdge, -correctedAngle);
                                IndexedMatrix rotateMatrix = IndexedMatrix.CreateFromQuaternion(orn2);
                                calculatedNormalB = new IndexedBasisMatrix(orn2) * normalA;
                            }


                            //alternatively use 
                            //IndexedVector3 calculatedNormalB2 = quatRotate(orn,normalA);


                            switch (sumvertsA)
                            {
                                case 1:
                                    {
                                        IndexedVector3 edge1 = m_triangleVerticesA[0] - m_triangleVerticesA[1];
                                        IndexedQuaternion orn = new IndexedQuaternion(edge1, -correctedAngle);
                                        IndexedVector3 computedNormalB = MathUtil.QuatRotate(orn, normalA);
                                        float bla = IndexedVector3.Dot(computedNormalB, normalB);
                                        if (bla < 0)
                                        {
                                            computedNormalB *= -1;
                                            info.m_flags |= TriangleInfoMap.TRI_INFO_V0V1_SWAP_NORMALB;
                                        }
#if DEBUG_INTERNAL_EDGE
                                        if ((computedNormalB - normalB).Length() > 0.0001f)
                                        {
                                            System.Console.WriteLine("warning: normals not identical");
                                        }
#endif//DEBUG_INTERNAL_EDGE

                                        info.m_edgeV0V1Angle = -correctedAngle;

                                        if (isConvex)
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:67,代码来源:InternalEdgeUtility.cs


示例17: AddObjectToWorld2

    internal static void AddObjectToWorld2(object pWorld, object pBody, Vector3 _position, Quaternion _orientation)
    {
        RigidBody body = pBody as RigidBody;
        DiscreteDynamicsWorld world = pWorld as DiscreteDynamicsWorld;
        //if (!(body.GetCollisionShape().GetShapeType() == BroadphaseNativeTypes.STATIC_PLANE_PROXYTYPE && body.GetCollisionShape().GetShapeType() == BroadphaseNativeTypes.TERRAIN_SHAPE_PROXYTYPE))

        world.AddRigidBody(body);
        IndexedVector3 vposition = new IndexedVector3(_position.X, _position.Y, _position.Z);
        IndexedQuaternion vquaternion = new IndexedQuaternion(_orientation.X, _orientation.Y, _orientation.Z,
                                                              _orientation.W);
        IndexedMatrix mat = IndexedMatrix.CreateFromQuaternion(vquaternion);
        mat._origin = vposition;
        body.SetWorldTransform(mat);
        //if (body.GetBroadphaseHandle() != null)
        //    world.UpdateSingleAabb(body);
    }
开发者ID:justasabc,项目名称:opensim75grid,代码行数:16,代码来源:BulletSimAPI.cs


示例18: SetTranslation2

 internal static void SetTranslation2(object pBody, Vector3 _position, Quaternion _orientation)
 {
     RigidBody body = pBody as RigidBody;
     IndexedVector3 vposition = new IndexedVector3(_position.X, _position.Y, _position.Z);
     IndexedQuaternion vquaternion = new IndexedQuaternion(_orientation.X, _orientation.Y, _orientation.Z,
                                                           _orientation.W);
     IndexedMatrix mat = IndexedMatrix.CreateFromQuaternion(vquaternion);
     mat._origin = vposition;
     body.SetWorldTransform(mat);
     
 }
开发者ID:justasabc,项目名称:opensim75grid,代码行数:11,代码来源:BulletSimAPI.cs


示例19: QuatRotate

        public IndexedVector3 QuatRotate(IndexedQuaternion rotation, IndexedVector3 v) 
        {
	        IndexedQuaternion q = rotation * v;
	        q *= rotation.Inverse();
	        return new IndexedVector3(q.X,q.Y,q.Z);
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:6,代码来源:IndexedQuaternion.cs


示例20: Create6DofConstraint2

    //BulletSimAPI.Create6DofConstraint2(m_world.ptr, m_body1.ptr, m_body2.ptr,frame1, frame1rot,frame2, frame2rot,useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
    internal static object Create6DofConstraint2(object pWorld, object pBody1, object pBody2, Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot, bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies)

    {
         DiscreteDynamicsWorld world = pWorld as DiscreteDynamicsWorld;
        RigidBody body1 = pBody1 as RigidBody;
        RigidBody body2 = pBody2 as RigidBody;
        IndexedVector3 frame1v = new IndexedVector3(pframe1.X, pframe1.Y, pframe1.Z);
        IndexedQuaternion frame1rot = new IndexedQuaternion(pframe1rot.X, pframe1rot.Y, pframe1rot.Z, pframe1rot.W);
        IndexedMatrix frame1 = IndexedMatrix.CreateFromQuaternion(frame1rot);
        frame1._origin = frame1v;

        IndexedVector3 frame2v = new IndexedVector3(pframe2.X, pframe2.Y, pframe2.Z);
        IndexedQuaternion frame2rot = new IndexedQuaternion(pframe2rot.X, pframe2rot.Y, pframe2rot.Z, pframe2rot.W);
        IndexedMatrix frame2 = IndexedMatrix.CreateFromQuaternion(frame2rot);
        frame2._origin = frame1v;

        Generic6DofConstraint consttr = new Generic6DofConstraint(body1, body2, ref frame1, ref frame2,
                                                                  puseLinearReferenceFrameA);
        consttr.CalculateTransforms();
        world.AddConstraint(consttr,pdisableCollisionsBetweenLinkedBodies);

        return consttr;
    }
开发者ID:justasabc,项目名称:opensim75grid,代码行数:24,代码来源:BulletSimAPI.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LinearMath.IndexedVector3类代码示例发布时间:2022-05-24
下一篇:
C# LinearMath.IndexedMatrix类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap