コード例 #1
0
ファイル: chainsLayer.cs プロジェクト: foobit/ChipmunkSharp
        void BreakableJointPostSolve(cpConstraint joint)
        {
            float dt = space.GetCurrentTimeStep();

            // Convert the impulse to a force by dividing it by the timestep.
            float force    = joint.GetImpulse() / dt;
            float maxForce = joint.GetMaxForce();// maxForce;

            // If the force is almost as big as the joint's max force, break it.
            if (force > 0.9 * maxForce)
            {
                space.AddPostStepCallback(
                    (s, o1, o2) => BreakablejointPostStepRemove(o1 as cpConstraint),
                    joint, null
                    );
            }
        }