Search in sources :

Example 1 with Broadphasing

use of spacegraph.space3d.phys.collision.broad.Broadphasing in project narchy by automenta.

the class Body3D method destroy.

public void destroy(Collisions world) {
    // Remove constraints from the dynamics world before you delete the related rigidbodies.
    assert (constraintRefs.isEmpty());
    forceActivationState(Collidable.DISABLE_SIMULATION);
    data = null;
    Broadphasing bp = broadphase;
    if (bp != null) {
        // 
        // only clear the cached algorithms
        // 
        world.broadphase.getOverlappingPairCache().cleanProxyFromPairs(bp, world.intersecter);
        world.broadphase.destroyProxy(bp, world.intersecter);
        broadphase(null);
    }
/*else {
        	//System.err.println(collidable + " missing broadphase");
			throw new RuntimeException(collidable + " missing broadphase");
		}*/
// if (broadphaseHandle!=null) {
// //broadphaseHandle.data = null;
// broadphaseHandle = null;
// }
// if (collisionShape!=null) {
// collisionShape.setUserPointer(null);
// collisionShape = null;
// }
}
Also used : Broadphasing(spacegraph.space3d.phys.collision.broad.Broadphasing)

Example 2 with Broadphasing

use of spacegraph.space3d.phys.collision.broad.Broadphasing in project narchy by automenta.

the class PairCachingGhostObject method addOverlappingObjectInternal.

/**
 * This method is mainly for expert/internal use only.
 */
@Override
public void addOverlappingObjectInternal(Broadphasing otherProxy, Broadphasing thisProxy) {
    Broadphasing actualThisProxy = thisProxy != null ? thisProxy : broadphase;
    assert (actualThisProxy != null);
    Collidable otherObject = otherProxy.data;
    assert (otherObject != null);
    // if this linearSearch becomes too slow (too many overlapping objects) we should add a more appropriate data structure
    int index = overlappingObjects.indexOf(otherObject);
    if (index == -1) {
        overlappingObjects.add(otherObject);
        hashPairCache.addOverlappingPair(actualThisProxy, otherProxy);
    }
}
Also used : Collidable(spacegraph.space3d.phys.Collidable) Broadphasing(spacegraph.space3d.phys.collision.broad.Broadphasing)

Example 3 with Broadphasing

use of spacegraph.space3d.phys.collision.broad.Broadphasing in project narchy by automenta.

the class PairCachingGhostObject method removeOverlappingObjectInternal.

@Override
public void removeOverlappingObjectInternal(Broadphasing otherProxy, Intersecter intersecter, Broadphasing thisProxy1) {
    Collidable otherObject = otherProxy.data;
    Broadphasing actualThisProxy = thisProxy1 != null ? thisProxy1 : broadphase;
    assert (actualThisProxy != null);
    assert (otherObject != null);
    int index = overlappingObjects.indexOf(otherObject);
    if (index != -1) {
        // return array[index];
        overlappingObjects.setFast(index, overlappingObjects.get(overlappingObjects.size() - 1));
        overlappingObjects.removeFast(overlappingObjects.size() - 1);
        hashPairCache.removeOverlappingPair(actualThisProxy, otherProxy, intersecter);
    }
}
Also used : Collidable(spacegraph.space3d.phys.Collidable) Broadphasing(spacegraph.space3d.phys.collision.broad.Broadphasing)

Aggregations

Broadphasing (spacegraph.space3d.phys.collision.broad.Broadphasing)3 Collidable (spacegraph.space3d.phys.Collidable)2