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;
// }
}
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);
}
}
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);
}
}
Aggregations