public class CollisionSpace extends NativePhysicsObject
btCollisionWorld.| Modifier and Type | Field and Description |
|---|---|
static java.util.logging.Logger |
loggerC
message logger for this class
|
loggerN| Modifier | Constructor and Description |
|---|---|
|
CollisionSpace(Vector3f worldMin,
Vector3f worldMax,
PhysicsSpace.BroadphaseType broadphaseType)
Instantiate a CollisionSpace.
|
protected |
CollisionSpace(Vector3f worldMin,
Vector3f worldMax,
PhysicsSpace.BroadphaseType broadphaseType,
int numSolvers)
Used internally.
|
protected |
CollisionSpace(Vector3f worldMin,
Vector3f worldMax,
PhysicsSpace.BroadphaseType broadphaseType,
int numSolvers,
CollisionConfiguration configuration)
Used internally.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.Object object)
Add the specified object to this space.
|
void |
addCollisionObject(PhysicsCollisionObject pco)
Add the specified collision object to this space.
|
int |
contactTest(PhysicsCollisionObject pco,
PhysicsCollisionListener listener)
Perform a contact test.
|
boolean |
contains(PhysicsCollisionObject pco)
Test whether the specified collision object is added to this space.
|
int |
countCollisionObjects()
Count the collision objects in this space.
|
int |
countSolvers()
Count the solvers.
|
protected void |
create()
Must be invoked on the designated physics thread.
|
void |
destroy()
Remove all collision objects and physics joints.
|
PhysicsSpace.BroadphaseType |
getBroadphaseType()
Read the type of acceleration structure used for broadphase collision
detection.
|
static CollisionSpace |
getCollisionSpace()
Access the CollisionSpace running on this thread.
|
CollisionConfiguration |
getConfiguration()
Access the tuning parameters.
|
java.util.Collection<PhysicsGhostObject> |
getGhostObjectList()
Enumerate ghost objects that have been added to this space and not yet
removed.
|
java.util.Collection<PhysicsCollisionObject> |
getPcoList()
Enumerate collision objects that have been added to this space and not
yet removed.
|
int |
getRayTestFlags()
Return the flags used in ray tests (native field: m_flags).
|
Vector3f |
getWorldMax(Vector3f storeResult)
Copy the maximum coordinate values for this space.
|
Vector3f |
getWorldMin(Vector3f storeResult)
Copy the minimum coordinate values for this space.
|
boolean |
hasClosest(CollisionShape shape0,
CollisionShape shape1)
Test whether a nontrivial closest-points algorithm is registered for the
specified collision shapes.
|
boolean |
hasContact(CollisionShape shape0,
CollisionShape shape1)
Test whether a nontrivial contact-points algorithm is registered for the
specified collision shapes.
|
protected void |
initThread(long spaceId)
Must be invoked on the designated physics thread.
|
boolean |
isEmpty()
Test whether this space is empty.
|
boolean |
isForceUpdateAllAabbs()
Test whether the bounding boxes of inactive collision objects should be
recomputed during each
update() (native field:
m_forceUpdateAllAabbs). |
boolean |
isUsingDeterministicDispatch()
Test whether the "deterministic overlapping pairs" option is enabled in
the collision dispatcher (native field: m_deterministicOverlappingPairs).
|
long |
jniEnvId()
Return the address of the JNIEnv that this space uses for callbacks.
|
boolean |
needsCollision(PhysicsCollisionObject pcoA,
PhysicsCollisionObject pcoB)
Callback to determine whether the specified objects should be allowed to
collide.
|
int |
pairTest(PhysicsCollisionObject pcoA,
PhysicsCollisionObject pcoB,
PhysicsCollisionListener listener)
Perform a pair test.
|
java.util.List<PhysicsRayTestResult> |
rayTest(Vector3f from,
Vector3f to)
Perform a ray-collision test (raycast) and sort the results by ascending
hitFraction.
|
java.util.List<PhysicsRayTestResult> |
rayTest(Vector3f from,
Vector3f to,
java.util.List<PhysicsRayTestResult> results)
Perform a ray-collision test (raycast) and sort the results by ascending
hitFraction.
|
java.util.List<PhysicsRayTestResult> |
rayTestDp(Vec3d from,
Vec3d to,
java.util.List<PhysicsRayTestResult> results)
Perform a ray-collision test (raycast) and sort the results by ascending
hitFraction.
|
java.util.List<PhysicsRayTestResult> |
rayTestRaw(Vector3f from,
Vector3f to)
Perform a ray-collision test (raycast) and return the results in
arbitrary order.
|
java.util.List<PhysicsRayTestResult> |
rayTestRaw(Vector3f from,
Vector3f to,
java.util.List<PhysicsRayTestResult> results)
Perform a ray-collision test (raycast) and return the results in
arbitrary order.
|
void |
remove(java.lang.Object object)
Remove the specified object from this space.
|
void |
removeCollisionObject(PhysicsCollisionObject pco)
Remove the specified collision object from this space.
|
void |
setForceUpdateAllAabbs(boolean desiredSetting)
Alter whether the bounding boxes of inactive collision objects should be
recomputed during each
update() (native field:
m_forceUpdateAllAabbs). |
void |
setRayTestFlags(int flags)
Alter the flags used in ray tests (native field: m_flags).
|
java.util.List<PhysicsSweepTestResult> |
sweepTest(ConvexShape shape,
Transform start,
Transform end,
java.util.List<PhysicsSweepTestResult> results,
float allowedCcdPenetration)
Perform a sweep-collision test and store the results in an existing list,
in arbitrary order.
|
void |
useDeterministicDispatch(boolean desiredSetting)
Enable or disable the "deterministic overlapping pairs" option in the
collision dispatcher (native field: m_deterministicOverlappingPairs).
|
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, toString, unassignNativeObjectpublic static final java.util.logging.Logger loggerC
public CollisionSpace(Vector3f worldMin, Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType)
worldMin - the desired minimum coordinate values (not null,
unaffected, default=(-10k,-10k,-10k))worldMax - the desired maximum coordinate values (not null,
unaffected, default=(10k,10k,10k))broadphaseType - which broadphase accelerator to use (not null)protected CollisionSpace(Vector3f worldMin, Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType, int numSolvers)
worldMin - the desired minimum coordinate values (not null,
unaffected, default=(-10k,-10k,-10k))worldMax - the desired maximum coordinate values (not null,
unaffected, default=(10k,10k,10k))broadphaseType - which broadphase accelerator to use (not null)numSolvers - the number of contact-and-constraint solvers in the
thread-safe pool (≥1, ≤64, default=1)protected CollisionSpace(Vector3f worldMin, Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType, int numSolvers, CollisionConfiguration configuration)
worldMin - the desired minimum coordinate values (not null,
unaffected, default=(-10k,-10k,-10k))worldMax - the desired maximum coordinate values (not null,
unaffected, default=(10k,10k,10k))broadphaseType - which broadphase accelerator to use (not null)numSolvers - the number of contact-and-constraint solvers in the
thread-safe pool (≥1, ≤64, default=1)configuration - the desired configuration (not null)public void add(java.lang.Object object)
object - the collision object to add (not null)public void addCollisionObject(PhysicsCollisionObject pco)
pco - the collision object to add (not null, modified)public int contactTest(PhysicsCollisionObject pco, PhysicsCollisionListener listener)
pco - the collision object to test (not null, unaffected)listener - the callback for reporting contacts (may be null)public boolean contains(PhysicsCollisionObject pco)
pco - the object to test (not null, unaffected)public int countCollisionObjects()
public int countSolvers()
public void destroy()
public PhysicsSpace.BroadphaseType getBroadphaseType()
public static CollisionSpace getCollisionSpace()
public CollisionConfiguration getConfiguration()
public java.util.Collection<PhysicsGhostObject> getGhostObjectList()
public java.util.Collection<PhysicsCollisionObject> getPcoList()
public int getRayTestFlags()
RayTestFlagpublic Vector3f getWorldMax(Vector3f storeResult)
storeResult - storage for the result (modified if not null)public Vector3f getWorldMin(Vector3f storeResult)
storeResult - storage for the result (modified if not null)public boolean hasClosest(CollisionShape shape0, CollisionShape shape1)
shape0 - the first shape to test (not null, unaffected)shape1 - the 2nd shape to test (not null, unaffected)public boolean hasContact(CollisionShape shape0, CollisionShape shape1)
shape0 - the first shape to test (not null, unaffected)shape1 - the 2nd shape to test (not null, unaffected)public boolean isEmpty()
public boolean isForceUpdateAllAabbs()
update() (native field:
m_forceUpdateAllAabbs).public boolean isUsingDeterministicDispatch()
public long jniEnvId()
public boolean needsCollision(PhysicsCollisionObject pcoA, PhysicsCollisionObject pcoB)
pcoA - the first collision object (not null)pcoB - the 2nd collision object (not null)public int pairTest(PhysicsCollisionObject pcoA, PhysicsCollisionObject pcoB, PhysicsCollisionListener listener)
pcoA - the first collision object to test (not null, unaffected)pcoB - the 2nd collision object to test (not null, unaffected)listener - the callback for reporting contacts (may be null)public java.util.List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to)
from - the starting location (physics-space coordinates, not null,
unaffected)to - the ending location (in physics-space coordinates, not null,
unaffected)public java.util.List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to, java.util.List<PhysicsRayTestResult> results)
from - the starting location (in physics-space coordinates, not
null, unaffected)to - the ending location (in physics-space coordinates, not null,
unaffected)results - the list to hold results (not null, modified)public java.util.List<PhysicsRayTestResult> rayTestDp(Vec3d from, Vec3d to, java.util.List<PhysicsRayTestResult> results)
from - the starting location (in physics-space coordinates, not
null, unaffected)to - the ending location (in physics-space coordinates, not null,
unaffected)results - the list to hold results (not null, modified)public java.util.List<PhysicsRayTestResult> rayTestRaw(Vector3f from, Vector3f to)
from - the starting location (in physics-space coordinates, not
null, unaffected)to - the ending location (in physics-space coordinates, not null,
unaffected)public java.util.List<PhysicsRayTestResult> rayTestRaw(Vector3f from, Vector3f to, java.util.List<PhysicsRayTestResult> results)
from - the starting location (in physics-space coordinates, not
null, unaffected)to - the ending location (in physics-space coordinates, not null,
unaffected)results - the list to hold results (not null, modified)public void remove(java.lang.Object object)
object - the collision object to remove, or nullpublic void removeCollisionObject(PhysicsCollisionObject pco)
pco - the collision object to remove (not null, modified)public void setForceUpdateAllAabbs(boolean desiredSetting)
update() (native field:
m_forceUpdateAllAabbs).desiredSetting - true → recompute all AABBs, false → skip
inactive objects (default=true)public void setRayTestFlags(int flags)
flags - the desired flags, ORed together (default=SubSimplexRaytest)RayTestFlagpublic java.util.List<PhysicsSweepTestResult> sweepTest(ConvexShape shape, Transform start, Transform end, java.util.List<PhysicsSweepTestResult> results, float allowedCcdPenetration)
The starting and ending locations must be at least 0.4 physics-space units apart.
A sweep test will miss a collision if it starts inside an object and sweeps away from the object's center. Also, sweep tests do not detect soft bodies.
shape - the shape to sweep (not null, convex, unaffected)start - the starting physics-space transform (not null, unaffected)end - the ending physics-space transform (not null, unaffected)results - the list to hold results (not null, modified)allowedCcdPenetration - (in physics-space units)public void useDeterministicDispatch(boolean desiredSetting)
desiredSetting - true → sorted/deterministic order, false
→ hashed/arbitrary order (default=false)protected void create()
protected void initThread(long spaceId)
spaceId - the Bullet identifier for this space (non-zero)