Package com.jme3.bullet
Class MultiBodySpace
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.CollisionSpace
com.jme3.bullet.PhysicsSpace
com.jme3.bullet.MultiBodySpace
- All Implemented Interfaces:
ContactListener
,Comparable<NativePhysicsObject>
- Direct Known Subclasses:
DeformableSpace
A PhysicsSpace that supports multibodies, with its own
btMultiBodyDynamicsWorld
.-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.bullet.PhysicsSpace
PhysicsSpace.BroadphaseType
-
Field Summary
Fields inherited from class com.jme3.bullet.CollisionSpace
loggerC
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ConstructorDescriptionMultiBodySpace
(com.jme3.math.Vector3f worldMin, com.jme3.math.Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType) Instantiate a MultiBodySpace with a sequential-impulse solver.MultiBodySpace
(com.jme3.math.Vector3f worldMin, com.jme3.math.Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType, SolverType solverType) Instantiate a MultiBodySpace with the specified contact-and-constraint solver. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activateAll
(boolean forceFlag) Activate all colliders and rigid bodies in this space.void
Add the specified object to this space.void
addMultiBody
(MultiBody multiBody) Add the specified MultiBody and all its colliders.boolean
Test whether the specified collision object is added to this space.int
Count the multibodies in this space.protected void
create()
Must be invoked on the designated physics thread.void
destroy()
Remove all multibodies, collision objects, and physics joints.Enumerate multibodies that have been added to this space and not yet removed.static MultiBodySpace
Access the MultiBodySpace running on this thread.Enumerate collision objects that have been added to this space and not yet removed.boolean
isEmpty()
Test whether this space is empty.void
Remove the specified object from this space.void
removeMultiBody
(MultiBody multiBody) Remove the specified MultiBody and all its colliders.protected void
Replace the existing contact-and-constraint solver with a new one of the correct type.Methods inherited from class com.jme3.bullet.PhysicsSpace
addAll, addCollisionListener, addCollisionObject, addContactListener, addContactListener, addJoint, addOngoingCollisionListener, addTickListener, contains, countCollisionListeners, countJoints, countManifolds, countRigidBodies, countTickListeners, distributeEvents, enqueue, enqueueOnThisThread, getAccuracy, getCharacterList, getContactManager, getGravity, getJointList, getJointMap, getPhysicsSpace, getRigidBodyList, getSolverInfo, getSolverNumIterations, getSolverType, getVehicleList, getWorldType, initSolverInfo, isCcdWithStaticOnly, isUsingScr, listManifoldIds, maxSubSteps, maxTimeStep, onContactEnded, onContactProcessed, onContactStarted, removeAll, removeCollisionListener, removeCollisionObject, removeContactListener, removeJoint, removeOngoingCollisionListener, removeTickListener, setAccuracy, setCcdWithStaticOnly, setContactManager, setGravity, setMaxSubSteps, setMaxTimeStep, setSolverNumIterations, update, update, update, useScr
Methods inherited from class com.jme3.bullet.CollisionSpace
addCollisionGroupListener, contactTest, countCollisionGroupListeners, countCollisionObjects, countSolvers, getBroadphaseType, getCollisionSpace, getConfiguration, getGhostObjectList, getRayTestFlags, getWorldMax, getWorldMin, hasClosest, hasContact, initThread, isForceUpdateAllAabbs, isUsingDeterministicDispatch, jniEnvId, needsCollision, pairTest, rayTest, rayTest, rayTestDp, rayTestRaw, rayTestRaw, removeCollisionGroupListener, setForceUpdateAllAabbs, setLocalThreadPhysicsSpace, setRayTestFlags, sweepTest, sweepTest, sweepTest, useDeterministicDispatch
Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, toString, unassignNativeObject
-
Field Details
-
logger2
message logger for this class
-
-
Constructor Details
-
MultiBodySpace
public MultiBodySpace(com.jme3.math.Vector3f worldMin, com.jme3.math.Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType) Instantiate a MultiBodySpace with a sequential-impulse solver. Must be invoked on the designated physics thread.- Parameters:
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)
-
MultiBodySpace
public MultiBodySpace(com.jme3.math.Vector3f worldMin, com.jme3.math.Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType, SolverType solverType) Instantiate a MultiBodySpace with the specified contact-and-constraint solver. Must be invoked on the designated physics thread.- Parameters:
worldMin
- the desired minimum coordinate value for each axis (not null, unaffected, default=(-10k,-10k,-10k))worldMax
- the desired maximum coordinate value for each axis (not null, unaffected, default=(10k,10k,10k))broadphaseType
- which broadphase accelerator to use (not null)solverType
- the desired constraint solver (not null)
-
-
Method Details
-
addMultiBody
Add the specified MultiBody and all its colliders.- Parameters:
multiBody
- (not null)
-
countMultiBodies
public int countMultiBodies()Count the multibodies in this space.- Returns:
- the count (≥0)
-
getMultiBodyList
Enumerate multibodies that have been added to this space and not yet removed.- Returns:
- a new unmodifiable collection of pre-existing instances (not null)
-
getMultiBodySpace
Access the MultiBodySpace running on this thread. For parallel physics, this may be invoked from the OpenGL thread.- Returns:
- the pre-existing MultiBodySpace running on this thread
-
removeMultiBody
Remove the specified MultiBody and all its colliders.- Parameters:
multiBody
- (not null)
-
activateAll
public void activateAll(boolean forceFlag) Activate all colliders and rigid bodies in this space.- Overrides:
activateAll
in classPhysicsSpace
- Parameters:
forceFlag
- true to force activation
-
add
Add the specified object to this space.- Overrides:
add
in classPhysicsSpace
- Parameters:
object
- the object to add (not null)
-
contains
Test whether the specified collision object is added to this space.- Overrides:
contains
in classPhysicsSpace
- Parameters:
pco
- the object to test (not null, unaffected)- Returns:
- true if currently added, otherwise false
-
create
protected void create()Must be invoked on the designated physics thread.- Overrides:
create
in classPhysicsSpace
-
destroy
public void destroy()Remove all multibodies, collision objects, and physics joints.- Overrides:
destroy
in classPhysicsSpace
-
getPcoList
Enumerate collision objects that have been added to this space and not yet removed.- Overrides:
getPcoList
in classPhysicsSpace
- Returns:
- a new modifiable collection of pre-existing instances (not null)
-
isEmpty
public boolean isEmpty()Test whether this space is empty.- Overrides:
isEmpty
in classPhysicsSpace
- Returns:
- true if empty, otherwise false
-
remove
Remove the specified object from this space.- Overrides:
remove
in classPhysicsSpace
- Parameters:
object
- the object to remove, or null
-
updateSolver
protected void updateSolver()Replace the existing contact-and-constraint solver with a new one of the correct type.- Overrides:
updateSolver
in classPhysicsSpace
-