Skip to content

"null jmePhysicsSpace in contactEndedCallback" when removing a rigid body from space #41

@Sweetzonzi

Description

@Sweetzonzi

As title, the console pops "null jmePhysicsSpace in contactEndedCallback" when removing a rigid body from space. It seems that it has no actual side effect, but quite annoying. Or did I get something worng?

int tick = 0;
PhysicsRigidBody dynaBall;

/**
 * Populate the PhysicsSpace. Invoked once during initialization.
 */
@Override
public void populateSpace() {
    // Create a CollisionShape for balls.
    float ballRadius = 1f;
    CollisionShape ballShape = new SphereCollisionShape(ballRadius);

    // Create a dynamic body and add it to the space.
    float mass = 2f;
    dynaBall = new PhysicsRigidBody(ballShape, mass);
    physicsSpace.addCollisionObject(dynaBall);

    // Create a static body and add it to the space.
    PhysicsRigidBody statBall
            = new PhysicsRigidBody(ballShape, PhysicsBody.massForStatic);
    physicsSpace.addCollisionObject(statBall);

    // Position the balls in physics space.
    dynaBall.setPhysicsLocation(new Vector3f(0f, 4f, 0f));
    statBall.setPhysicsLocation(new Vector3f(0.1f, 0f, 0f));

    // Visualize both rigid bodies.
    visualizeShape(dynaBall);
    visualizeShape(statBall);
}

/**
 * Advance the physics simulation by the specified amount. Invoked during
 * each update.
 *
 * @param wallClockSeconds the elapsed wall-clock time since the previous
 *                         invocation of {@code updatePhysics} (in seconds, ≥0)
 */
@Override
public void updatePhysics(float wallClockSeconds) {
    physicsSpace.update(wallClockSeconds, 10, true, false, false);
    tick++;
    if (tick == 200) {
        physicsSpace.remove(dynaBall);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions