Java Code Examples for com.jme3.bullet.PhysicsSpace#addCollisionListener()

The following examples show how to use com.jme3.bullet.PhysicsSpace#addCollisionListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KinematicRagdollControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
protected void addPhysics(PhysicsSpace space) {
    if (baseRigidBody != null) {
        space.add(baseRigidBody);
    }
    for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) {
        PhysicsBoneLink physicsBoneLink = it.next();
        if (physicsBoneLink.rigidBody != null) {
            space.add(physicsBoneLink.rigidBody);
            if (physicsBoneLink.joint != null) {
                space.add(physicsBoneLink.joint);

            }
        }
    }
    space.addCollisionListener(this);
}
 
Example 2
Source File: BombControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void setPhysicsSpace(PhysicsSpace space) {
    super.setPhysicsSpace(space);
    if (space != null) {
        space.addCollisionListener(this);
    }
}
 
Example 3
Source File: DynamicAnimControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Add all managed physics objects to the PhysicsSpace.
 */
@Override
protected void addPhysics(PhysicsSpace space) {
    super.addPhysics(space);

    space.addCollisionListener(this);
    space.addTickListener(this);
}
 
Example 4
Source File: BombControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setPhysicsSpace(PhysicsSpace space) {
    super.setPhysicsSpace(space);
    if (space != null) {
        space.addCollisionListener(this);
    }
}