Ejemplo n.º 1
0
 public BSHingeConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
                          Vector3 pivotInA, Vector3 pivotInB,
                          Vector3 axisInA, Vector3 axisInB,
                          bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
 {
     m_world      = world;
     m_body1      = obj1;
     m_body2      = obj2;
     m_constraint = new BulletConstraint(
         BulletSimAPI.CreateHingeConstraint2(m_world.ptr, m_body1.ptr, m_body2.ptr,
                                             pivotInA, pivotInB,
                                             axisInA, axisInB,
                                             useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
     m_enabled = true;
 }
Ejemplo n.º 2
0
 public BSHingeConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
                 Vector3 pivotInA, Vector3 pivotInB,
                 Vector3 axisInA, Vector3 axisInB,
                 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
 {
     m_world = world;
     m_body1 = obj1;
     m_body2 = obj2;
     m_constraint = new BulletConstraint(
                         BulletSimAPI.CreateHingeConstraint2(m_world.ptr, m_body1.ptr, m_body2.ptr,
                             pivotInA, pivotInB,
                             axisInA, axisInB,
                             useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
     m_enabled = true;
 }
Ejemplo n.º 3
0
 // Create a btGeneric6DofConstraint
 public BS6DofConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
                         Vector3 frame1, Quaternion frame1rot,
                         Vector3 frame2, Quaternion frame2rot,
                         bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
 {
     m_world      = world;
     m_body1      = obj1;
     m_body2      = obj2;
     m_constraint = new BulletConstraint(
         BulletSimAPI.Create6DofConstraint2(m_world.ptr, m_body1.ptr, m_body2.ptr,
                                            frame1, frame1rot,
                                            frame2, frame2rot,
                                            useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
     m_enabled = true;
     world.physicsScene.DetailLog("{0},BS6DofConstraint,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}",
                                  BSScene.DetailLogZero, world.worldID,
                                  obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X"));
 }
Ejemplo n.º 4
0
 // Create a btGeneric6DofConstraint
 public BS6DofConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
                 Vector3 frame1, Quaternion frame1rot,
                 Vector3 frame2, Quaternion frame2rot,
                 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
 {
     m_world = world;
     m_body1 = obj1;
     m_body2 = obj2;
     m_constraint = new BulletConstraint(
                         BulletSimAPI.Create6DofConstraint2(m_world.ptr, m_body1.ptr, m_body2.ptr,
                             frame1, frame1rot,
                             frame2, frame2rot,
                             useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
     m_enabled = true;
     world.physicsScene.DetailLog("{0},BS6DofConstraint,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}",
                         BSScene.DetailLogZero, world.worldID,
                         obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X"));
 }
Ejemplo n.º 5
0
 public BS6DofConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
                 Vector3 joinPoint,
                 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
 {
     m_world = world;
     m_body1 = obj1;
     m_body2 = obj2;
     if (obj1.ptr == IntPtr.Zero || obj2.ptr == IntPtr.Zero)
     {
         world.physicsScene.DetailLog("{0},BS6DOFConstraint,badBodyPtr,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}",
                         BSScene.DetailLogZero, world.worldID,
                         obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X"));
         world.physicsScene.Logger.ErrorFormat("{0} Attempt to build 6DOF constraint with missing bodies: wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}",
                         "[BULLETSIM 6DOF CONSTRAINT]", world.worldID,
                         obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X"));
         m_enabled = false;
     }
     else
     {
         m_constraint = new BulletConstraint(
                             BulletSimAPI.Create6DofConstraintToPoint2(m_world.ptr, m_body1.ptr, m_body2.ptr,
                                 joinPoint,
                                 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
         world.physicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}",
                             BSScene.DetailLogZero, world.worldID, m_constraint.ptr.ToString("X"),
                             obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X"));
         if (m_constraint.ptr == IntPtr.Zero)
         {
             world.physicsScene.Logger.ErrorFormat("{0} Failed creation of 6Dof constraint. rootID={1}, childID={2}",
                             LogHeader, obj1.ID, obj2.ID);
             m_enabled = false;
         }
         else
         {
             m_enabled = true;
         }
     }
 }
Ejemplo n.º 6
0
 public BS6DofConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
                         Vector3 joinPoint,
                         bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
 {
     m_world = world;
     m_body1 = obj1;
     m_body2 = obj2;
     if (obj1.ptr == IntPtr.Zero || obj2.ptr == IntPtr.Zero)
     {
         world.physicsScene.DetailLog("{0},BS6DOFConstraint,badBodyPtr,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}",
                                      BSScene.DetailLogZero, world.worldID,
                                      obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X"));
         world.physicsScene.Logger.ErrorFormat("{0} Attempt to build 6DOF constraint with missing bodies: wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}",
                                               "[BULLETSIM 6DOF CONSTRAINT]", world.worldID,
                                               obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X"));
         m_enabled = false;
     }
     else
     {
         m_constraint = new BulletConstraint(
             BulletSimAPI.Create6DofConstraintToPoint2(m_world.ptr, m_body1.ptr, m_body2.ptr,
                                                       joinPoint,
                                                       useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
         world.physicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}",
                                      BSScene.DetailLogZero, world.worldID, m_constraint.ptr.ToString("X"),
                                      obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X"));
         if (m_constraint.ptr == IntPtr.Zero)
         {
             world.physicsScene.Logger.ErrorFormat("{0} Failed creation of 6Dof constraint. rootID={1}, childID={2}",
                                                   LogHeader, obj1.ID, obj2.ID);
             m_enabled = false;
         }
         else
         {
             m_enabled = true;
         }
     }
 }
Ejemplo n.º 7
0
 public abstract bool SpringSetEquilibriumPoint(BulletConstraint constrain, int index, float equilibriumPoint);
Ejemplo n.º 8
0
 public abstract bool SliderSet(BulletConstraint constrain, int softRestDamp, int dirLimOrtho, int linAng, float val);
Ejemplo n.º 9
0
 public abstract bool SetFrames(BulletConstraint constrain,
                                Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
Ejemplo n.º 10
0
 public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold);
Ejemplo n.º 11
0
 public abstract bool HingeSetLimits(BulletConstraint constrain, float low, float high, float softness, float bias, float relaxation);
Ejemplo n.º 12
0
 public abstract bool DestroyConstraint(BulletWorld world, BulletConstraint constrain);
Ejemplo n.º 13
0
        public override bool TranslationalLimitMotor(BulletConstraint pConstraint, float ponOff, float targetVelocity, float maxMotorForce)
        {
            TypedConstraint tconstrain = (pConstraint as BulletConstraintXNA).constrain;
            bool onOff = ponOff != 0;
            bool ret = false;

            switch (tconstrain.GetConstraintType())
            {
            case TypedConstraintType.D6_CONSTRAINT_TYPE:
                Generic6DofConstraint constrain = tconstrain as Generic6DofConstraint;
                constrain.GetTranslationalLimitMotor().m_enableMotor[0] = onOff;
                constrain.GetTranslationalLimitMotor().m_targetVelocity[0] = targetVelocity;
                constrain.GetTranslationalLimitMotor().m_maxMotorForce[0] = maxMotorForce;
                ret = true;
                break;
            }

            return ret;
        }
Ejemplo n.º 14
0
 public override bool SetLinearLimits(BulletConstraint pConstraint, Vector3 low, Vector3 high)
 {
     Generic6DofConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofConstraint;
     IndexedVector3 lowlimit = new IndexedVector3(low.X, low.Y, low.Z);
     IndexedVector3 highlimit = new IndexedVector3(high.X, high.Y, high.Z);
     constraint.SetLinearLowerLimit(lowlimit);
     constraint.SetLinearUpperLimit(highlimit);
     return true;
 }
Ejemplo n.º 15
0
        //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;

            // 20131224 not used        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;
            constraint.SetFrames(ref frame1, ref frame2);
            return true;
        }
Ejemplo n.º 16
0
 public abstract bool UseFrameOffset(BulletConstraint constrain, float enable);
Ejemplo n.º 17
0
 public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects);
Ejemplo n.º 18
0
 public override bool UseFrameOffset(BulletConstraint pConstraint, float onOff)
 {
     Generic6DofConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofConstraint;
     constraint.SetUseFrameOffset((onOff == 0) ? false : true);
     return true;
 }
Ejemplo n.º 19
0
 // =====================================================================================
 // btCollisionObject entries
 public abstract Vector3 GetAnisotripicFriction(BulletConstraint constrain);
Ejemplo n.º 20
0
 public override void AddConstraintRef(BulletBody pBody, BulletConstraint pConstraint)
 {
     RigidBody body = (pBody as BulletBodyXNA).rigidBody;
     TypedConstraint constrain = (pConstraint as BulletConstraintXNA).constrain;
     body.AddConstraintRef(constrain);
 }
Ejemplo n.º 21
0
 public abstract void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain);
Ejemplo n.º 22
0
        public override bool AddConstraintToWorld(BulletWorld pWorld, BulletConstraint pConstraint, bool pDisableCollisionsBetweenLinkedObjects)
        {
            DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
            TypedConstraint constraint = (pConstraint as BulletConstraintXNA).constrain;
            world.AddConstraint(constraint, pDisableCollisionsBetweenLinkedObjects);

            return true;
        }
Ejemplo n.º 23
0
 public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations);
Ejemplo n.º 24
0
 public override bool CalculateTransforms(BulletConstraint pConstraint)
 {
     Generic6DofConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofConstraint;
     constraint.CalculateTransforms();
     return true;
 }
Ejemplo n.º 25
0
 public abstract bool SliderMotor(BulletConstraint constrain, int forceVel, int linAng, float val);
Ejemplo n.º 26
0
 public override bool DestroyConstraint(BulletWorld pWorld, BulletConstraint pConstraint)
 {
     DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
     TypedConstraint constraint = (pConstraint as BulletConstraintXNA).constrain;
     world.RemoveConstraint(constraint);
     return true;
 }
Ejemplo n.º 27
0
 public abstract bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse);
Ejemplo n.º 28
0
 public override Vector3 GetAnisotripicFriction(BulletConstraint pconstrain)
 {
     /* TODO */
     return Vector3.Zero;
 }
Ejemplo n.º 29
0
 public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce);
Ejemplo n.º 30
0
 public abstract void AddConstraintRef(BulletBody obj, BulletConstraint constrain);
Ejemplo n.º 31
0
 public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce);
Ejemplo n.º 32
0
 public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects);
Ejemplo n.º 33
0
 public abstract void AddConstraintRef(BulletBody obj, BulletConstraint constrain);
Ejemplo n.º 34
0
 public abstract bool CalculateTransforms(BulletConstraint constrain);
Ejemplo n.º 35
0
 public abstract bool CalculateTransforms(BulletConstraint constrain);
Ejemplo n.º 36
0
 public abstract bool DestroyConstraint(BulletWorld world, BulletConstraint constrain);
Ejemplo n.º 37
0
 public virtual void DumpConstraint(BulletWorld sim, BulletConstraint constrain)
 {
 }
Ejemplo n.º 38
0
 public virtual void DumpConstraint(BulletWorld sim, BulletConstraint constrain)
 {
 }
Ejemplo n.º 39
0
 public abstract bool HasAnisotripicFriction(BulletConstraint constrain);
Ejemplo n.º 40
0
 // =====================================================================================
 // btCollisionObject entries
 public abstract Vector3 GetAnisotripicFriction(BulletConstraint constrain);
Ejemplo n.º 41
0
 public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain);
Ejemplo n.º 42
0
 public abstract bool HasAnisotripicFriction(BulletConstraint constrain);
Ejemplo n.º 43
0
 public abstract Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict);
Ejemplo n.º 44
0
 public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain);
Ejemplo n.º 45
0
 public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse);
Ejemplo n.º 46
0
 public abstract void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain);
Ejemplo n.º 47
0
 public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
Ejemplo n.º 48
0
 public abstract Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict);
Ejemplo n.º 49
0
 public abstract bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi);
Ejemplo n.º 50
0
 public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold);
Ejemplo n.º 51
0
 public abstract bool SliderMotorEnable(BulletConstraint constrain, int linAng, float numericTrueFalse);
Ejemplo n.º 52
0
 public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse);
Ejemplo n.º 53
0
 public abstract bool SliderSetLimits(BulletConstraint constrain, int lowerUpper, int linAng, float val);
Ejemplo n.º 54
0
 public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations);
Ejemplo n.º 55
0
 public abstract bool SpringSetDamping(BulletConstraint constrain, int index, float damping);
Ejemplo n.º 56
0
 public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
Ejemplo n.º 57
0
 public abstract bool SpringSetStiffness(BulletConstraint constrain, int index, float stiffnesss);
Ejemplo n.º 58
0
 public abstract bool SetFrames(BulletConstraint constrain,
     Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
Ejemplo n.º 59
0
 public abstract bool UseFrameOffset(BulletConstraint constrain, float enable);
Ejemplo n.º 60
0
 public abstract bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi);