MinieLibrary/src/test/java/jme3utilities/minie/test/TestDefaults.java
/**
     * Test the defaults that are common to all newly-created rigid bodies.
     *
     * @param prb the body to test (not null, unaffected)
     */
Test the defaults that are common to all newly-created rigid bodies.
@param prb the body to test (not null, unaffected)
Test the defaults that are common to all newly - created rigid bodies . @param prb the body to test ( not null unaffected )
private void testRigidBody(PhysicsRigidBody prb) {
        Assert.assertNotNull(prb);
        testPco(prb);
        Assert.assertEquals(0, prb.countJoints());
        Assert.assertEquals(Activation.active, prb.getActivationState());
        Assert.assertEquals(0f, prb.getAngularDamping(), 0f);
        MinieTest.assertEquals(1f, 1f, 1f, prb.getAngularFactor(null), 0f);
        Assert.assertEquals(1f, prb.getAngularSleepingThreshold(), 0f);
        MinieTest.assertEquals(0f, 0f, 0f, prb.getGravity(null), 0f);
        Assert.assertEquals(0f, prb.getLinearDamping(), 0f);
        MinieTest.assertEquals(1f, 1f, 1f, prb.getLinearFactor(null), 0f);
        Assert.assertEquals(0.8f, prb.getLinearSleepingThreshold(), 0f);
        Assert.assertTrue(prb.isContactResponse());
        Assert.assertFalse(prb.isGravityProtected());
        Assert.assertFalse(prb.isKinematic());
        Assert.assertEquals(0, prb.listJoints().length);
        MinieTest.assertEquals(0f, 0f, 0f, prb.totalAppliedForce(null), 0f);
        MinieTest.assertEquals(0f, 0f, 0f, prb.totalAppliedTorque(null), 0f);
        if (prb.getMass() > 0f) {
            MinieTest.assertEquals(0f, 0f, 0f,
                    prb.getAngularVelocity(null), 0f);
            MinieTest.assertEquals(0f, 0f, 0f,
                    prb.getAngularVelocityLocal(null), 0f);
            MinieTest.assertEquals(0f, 0f, 0f,
                    prb.getLinearVelocity(null), 0f);
            Assert.assertEquals(1f, prb.getMass(), 0f);
            Assert.assertEquals(0f, prb.getSquaredSpeed(), 0f);
            Assert.assertTrue(prb.isDynamic());
            Assert.assertFalse(prb.isStatic());
            Assert.assertEquals(0f, prb.kineticEnergy(), 0f);
            Assert.assertEquals(0f, prb.mechanicalEnergy(), 0f);
        } else {
            Assert.assertEquals(0f, prb.getMass(), 0f);
            Assert.assertFalse(prb.isDynamic());
            Assert.assertTrue(prb.isStatic());
        }
        if (prb instanceof RigidBodyControl) {
            RigidBodyControl rbc = (RigidBodyControl) prb;
            Assert.assertNull(rbc.getSpatial());
            Assert.assertFalse(rbc.isApplyPhysicsLocal());
            Assert.assertFalse(rbc.isApplyScale());
            Assert.assertTrue(rbc.isKinematicSpatial());
        }
    }
private void testRigidBody ( PhysicsRigidBody prb ) { Assert . assertNotNull ( prb ) ; testPco ( prb ) ; Assert . assertEquals ( 0 , prb . countJoints ( ) ) ; Assert . assertEquals ( Activation . active , prb . getActivationState ( ) ) ; Assert . assertEquals ( 0f , prb . getAngularDamping ( ) , 0f ) ; MinieTest . assertEquals ( 1f , 1f , 1f , prb . getAngularFactor ( null ) , 0f ) ; Assert . assertEquals ( 1f , prb . getAngularSleepingThreshold ( ) , 0f ) ; MinieTest . assertEquals ( 0f , 0f , 0f , prb . getGravity ( null ) , 0f ) ; Assert . assertEquals ( 0f , prb . getLinearDamping ( ) , 0f ) ; MinieTest . assertEquals ( 1f , 1f , 1f , prb . getLinearFactor ( null ) , 0f ) ; Assert . assertEquals ( 0.8f , prb . getLinearSleepingThreshold ( ) , 0f ) ; Assert . assertTrue ( prb . isContactResponse ( ) ) ; Assert . assertFalse ( prb . isGravityProtected ( ) ) ; Assert . assertFalse ( prb . isKinematic ( ) ) ; Assert . assertEquals ( 0 , prb . listJoints ( ) . length ) ; MinieTest . assertEquals ( 0f , 0f , 0f , prb . totalAppliedForce ( null ) , 0f ) ; MinieTest . assertEquals ( 0f , 0f , 0f , prb . totalAppliedTorque ( null ) , 0f ) ; if ( prb . getMass ( ) > 0f ) { MinieTest . assertEquals ( 0f , 0f , 0f , prb . getAngularVelocity ( null ) , 0f ) ; MinieTest . assertEquals ( 0f , 0f , 0f , prb . getAngularVelocityLocal ( null ) , 0f ) ; MinieTest . assertEquals ( 0f , 0f , 0f , prb . getLinearVelocity ( null ) , 0f ) ; Assert . assertEquals ( 1f , prb . getMass ( ) , 0f ) ; Assert . assertEquals ( 0f , prb . getSquaredSpeed ( ) , 0f ) ; Assert . assertTrue ( prb . isDynamic ( ) ) ; Assert . assertFalse ( prb . isStatic ( ) ) ; Assert . assertEquals ( 0f , prb . kineticEnergy ( ) , 0f ) ; Assert . assertEquals ( 0f , prb . mechanicalEnergy ( ) , 0f ) ; } else { Assert . assertEquals ( 0f , prb . getMass ( ) , 0f ) ; Assert . assertFalse ( prb . isDynamic ( ) ) ; Assert . assertTrue ( prb . isStatic ( ) ) ; } if ( prb instanceof RigidBodyControl ) { RigidBodyControl rbc = ( RigidBodyControl ) prb ; Assert . assertNull ( rbc . getSpatial ( ) ) ; Assert . assertFalse ( rbc . isApplyPhysicsLocal ( ) ) ; Assert . assertFalse ( rbc . isApplyScale ( ) ) ; Assert . assertTrue ( rbc . isKinematicSpatial ( ) ) ; } }
Test the defaults that are common to all newly-created rigid bodies.
Test the defaults that are common to all newly - created rigid bodies .