示例#1
0
文件: RigidBody.cs 项目: himapo/ccm
        internal void setupRigidBody(RigidBodyConstructionInfo constructionInfo)
        {
            m_linearVelocity.setValue(0.0f, 0.0f, 0.0f);
            m_angularVelocity.setValue(0f, 0f, 0f);
            m_angularFactor.setValue(1, 1, 1);
            m_linearFactor.setValue(1, 1, 1);
            m_gravity.setValue(0.0f, 0.0f, 0.0f);
            m_gravity_acceleration.setValue(0.0f, 0.0f, 0.0f);
            m_totalForce.setValue(0.0f, 0.0f, 0.0f);
            m_totalTorque.setValue(0.0f, 0.0f, 0.0f);
            m_linearDamping = 0f;
            m_angularDamping = 0.5f;
            m_linearSleepingThreshold = constructionInfo.m_linearSleepingThreshold;
            m_angularSleepingThreshold = constructionInfo.m_angularSleepingThreshold;
            m_optionalMotionState = constructionInfo.m_motionState;
            m_contactSolverType = 0;
            m_frictionSolverType = 0;
            m_additionalDamping = constructionInfo.m_additionalDamping;
            m_additionalDampingFactor = constructionInfo.m_additionalDampingFactor;
            m_additionalLinearDampingThresholdSqr = constructionInfo.m_additionalLinearDampingThresholdSqr;
            m_additionalAngularDampingThresholdSqr = constructionInfo.m_additionalAngularDampingThresholdSqr;
            m_additionalAngularDampingFactor = constructionInfo.m_additionalAngularDampingFactor;

            if (m_optionalMotionState != null)
            {
                m_optionalMotionState.getWorldTransform(out WorldTransform);
            }
            else
            {
                WorldTransform = constructionInfo.m_startWorldTransform;
            }

            m_interpolationWorldTransform = WorldTransform;
            m_interpolationLinearVelocity.setValue(0, 0, 0);
            m_interpolationAngularVelocity.setValue(0, 0, 0);

            //moved to btCollisionObject
            m_friction = constructionInfo.m_friction;
            m_restitution = constructionInfo.m_restitution;

            this.CollisionShape = constructionInfo.m_collisionShape;
            m_debugBodyId = uniqueId++;

            setMassProps(constructionInfo.m_mass, constructionInfo.m_localInertia);
            setDamping(constructionInfo.m_linearDamping, constructionInfo.m_angularDamping);
            updateInertiaTensor();

            RigidBodyFlag = RigidBodyFlags.BT_NONE;


            m_deltaLinearVelocity.setZero();
            m_deltaAngularVelocity.setZero();
            m_invMass = m_linearFactor * m_inverseMass;
            m_pushVelocity.setZero();
            m_turnVelocity.setZero();

        }
示例#2
0
文件: RigidBody.cs 项目: himapo/ccm
 //constructors
 public RigidBody(RigidBodyConstructionInfo constructionInfo)
 {
     setupRigidBody(constructionInfo);
 }