Package com.jme3.bullet.objects
Class PhysicsGhostObject
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.collision.PhysicsCollisionObject
com.jme3.bullet.objects.PhysicsGhostObject
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
A collision object for intangibles, based on Bullet's
btPairCachingGhostObject
. This is useful for creating a character
controller, collision sensors/triggers, explosions etc.
Overlap detection skips the narrow-phase collision-detection algorithm and
relies entirely on the broad-phase algorithm, which is AABB plus a margin of
about 0.06 world units. Precise collision detection is still available via
PhysicsSpace.addCollisionListener()
.
From Bullet manual:
btGhostObject is a special btCollisionObject, useful for fast localized
collision queries.
-
Field Summary
Fields inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
COLLISION_GROUP_01, COLLISION_GROUP_02, COLLISION_GROUP_03, COLLISION_GROUP_04, COLLISION_GROUP_05, COLLISION_GROUP_06, COLLISION_GROUP_07, COLLISION_GROUP_08, COLLISION_GROUP_09, COLLISION_GROUP_10, COLLISION_GROUP_11, COLLISION_GROUP_12, COLLISION_GROUP_13, COLLISION_GROUP_14, COLLISION_GROUP_15, COLLISION_GROUP_16, COLLISION_GROUP_NONE, logger
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ConstructorDescriptionPhysicsGhostObject
(CollisionShape shape) Instantiate a ghost object with the specified CollisionShape. -
Method Summary
Modifier and TypeMethodDescriptiongetOverlapping
(int index) Access an overlapping collision object by its position in the list.int
Count how many collision objects this object overlaps.Update and access a list of overlapping objects.void
setCollisionShape
(CollisionShape collisionShape) Apply the specified CollisionShape to this object.void
setPhysicsLocation
(Vector3f location) Directly alter the location of the ghost's center.void
setPhysicsLocationDp
(Vec3d location) Directly alter the location of the ghost's center.void
setPhysicsRotation
(Matrix3f orientation) Directly alter the ghost's orientation.void
setPhysicsRotation
(Quaternion orientation) Directly alter the ghost's orientation.void
setPhysicsRotationDp
(Matrix3d orientation) Directly alter the ghost's orientation.void
setPhysicsRotationDp
(Quatd orientation) Directly alter the ghost's orientation.Methods inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
activate, addCollideWithGroup, addToIgnoreList, attachCollisionShape, boundingBox, clearIgnoreList, collisionFlags, copyPcoProperties, countIgnored, finalizeNative, findInstance, getActivationState, getAnisotropicFriction, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getCollideWithGroups, getCollisionGroup, getCollisionShape, getCollisionSpace, getContactDamping, getContactProcessingThreshold, getContactStiffness, getDeactivationTime, getFriction, getInternalType, getPhysicsLocation, getPhysicsLocationDp, getPhysicsRotation, getPhysicsRotationDp, getPhysicsRotationMatrix, getPhysicsRotationMatrixDp, getRestitution, getRollingFriction, getScale, getSpinningFriction, getTransform, getTransformDp, getUserObject, hasAnisotropicFriction, ignores, initUserPointer, isActive, isContactResponse, isInWorld, isStatic, listIgnoredPcos, proxyGroup, proxyMask, removeCollideWithGroup, removeFromIgnoreList, setActivationState, setAnisotropicFriction, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollideWithGroups, setCollisionFlags, setCollisionGroup, setContactDamping, setContactProcessingThreshold, setContactStiffness, setDeactivationTime, setFriction, setIgnoreList, setLocationAndBasis, setRestitution, setRollingFriction, setSpinningFriction, setUserIndex, setUserIndex2, setUserIndex3, setUserObject, spaceId, toString, userIndex, userIndex2, userIndex3
Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, unassignNativeObject
-
Field Details
-
logger2
message logger for this class
-
-
Constructor Details
-
PhysicsGhostObject
Instantiate a ghost object with the specified CollisionShape. The new object is not added to any CollisionSpace.- Parameters:
shape
- the desired shape (not null, alias created)
-
-
Method Details
-
getOverlapping
Access an overlapping collision object by its position in the list. Important:getOverlappingObjects()
must be invoked first!- Parameters:
index
- which list position (≥0, <count)- Returns:
- the pre-existing object
-
getOverlappingCount
public int getOverlappingCount()Count how many collision objects this object overlaps.- Returns:
- the count (≥0)
-
getOverlappingObjects
Update and access a list of overlapping objects.- Returns:
- an internal list which may get reused (not null)
-
setPhysicsLocation
Directly alter the location of the ghost's center.- Parameters:
location
- the desired location (in physics-space coordinates, not null, finite, unaffected)
-
setPhysicsLocationDp
Directly alter the location of the ghost's center.- Parameters:
location
- the desired location (in physics-space coordinates, not null, finite, unaffected)
-
setPhysicsRotation
Directly alter the ghost's orientation.- Parameters:
orientation
- the desired orientation (a rotation matrix in physics-space coordinates, not null, unaffected)
-
setPhysicsRotation
Directly alter the ghost's orientation.- Parameters:
orientation
- the desired orientation (a rotation quaternion in physics-space coordinates, not null, not zero, unaffected)
-
setPhysicsRotationDp
Directly alter the ghost's orientation.- Parameters:
orientation
- the desired orientation (a rotation matrix in physics-space coordinates, not null, unaffected)
-
setPhysicsRotationDp
Directly alter the ghost's orientation.- Parameters:
orientation
- the desired orientation (a rotation quaternion in physics-space coordinates, not null, not zero, unaffected)
-
setCollisionShape
Apply the specified CollisionShape to this object. Note that the object should not be in any CollisionSpace while changing shape; the object gets rebuilt on the physics side.- Overrides:
setCollisionShape
in classPhysicsCollisionObject
- Parameters:
collisionShape
- the shape to apply (not null, alias created)
-