Package com.jme3.bullet.joints
Class Anchor
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.joints.PhysicsJoint
com.jme3.bullet.joints.Anchor
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
A PhysicsJoint to join a particular node of a soft body (A) to a rigid body
(B), based on Bullet's btSoftBody::Anchor.
-
Field Summary
Fields inherited from class com.jme3.bullet.joints.PhysicsJoint
logger
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ConstructorDescriptionAnchor
(PhysicsSoftBody softBodyA, int nodeIndexA, PhysicsRigidBody rigidBodyB, Vector3f pivotInB, boolean allowCollisions) Instantiate an anchor with influence=1. -
Method Summary
Modifier and TypeMethodDescriptionCopy the location of the connection point in the rigid body at the B end.Access the rigid body at the B end.Access the soft body at the A end.float
Return how much influence the anchor has on the bodies.boolean
Test whether collisions are allowed between the bodies.boolean
Test whether this Anchor is enabled.int
Return the index of the anchored node in body A.void
setInfluence
(float amount) Alter how much influence the anchor has on the bodies.void
setPivotInB
(Vector3f location) Alter the pivot location in B's local coordinates.Methods inherited from class com.jme3.bullet.joints.PhysicsJoint
countEnds, destroy, findEnd, findOtherBody, getBody, getBodyA, getBodyB, getPhysicsSpace, setBodyA, setBodyB, setNativeId, setPhysicsSpace, toString
Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeIdNotTracked, unassignNativeObject
-
Field Details
-
logger2
message logger for this class
-
-
Constructor Details
-
Anchor
public Anchor(PhysicsSoftBody softBodyA, int nodeIndexA, PhysicsRigidBody rigidBodyB, Vector3f pivotInB, boolean allowCollisions) Instantiate an anchor with influence=1.- Parameters:
softBodyA
- the soft body for the A end (not null, alias created)nodeIndexA
- the index of the node for the A end (≥0, <numNodes)rigidBodyB
- the rigid body for the B end (not null, alias created)pivotInB
- the pivot location in B's scaled local coordinates (not null, unaffected)allowCollisions
- true→allow collisions between the bodies, false→disallow such collisions
-
-
Method Details
-
copyPivot
Copy the location of the connection point in the rigid body at the B end.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a location vector (in B's scaled local coordinates, either storeResult or a new instance)
-
getRigidBody
Access the rigid body at the B end.- Returns:
- the pre-existing body (not null)
-
getSoftBody
Access the soft body at the A end.- Returns:
- the pre-existing soft body (not null)
-
influence
public float influence()Return how much influence the anchor has on the bodies.- Returns:
- the amount (≥0, ≤1, 0→no influence, 1→strong influence)
-
isAllowCollision
public boolean isAllowCollision()Test whether collisions are allowed between the bodies.- Returns:
- true if collisions are allowed, otherwise false
-
nodeIndex
public int nodeIndex()Return the index of the anchored node in body A.- Returns:
- the node index (≥0)
-
setInfluence
public void setInfluence(float amount) Alter how much influence the anchor has on the bodies.- Parameters:
amount
- the degree of influence (≥0, ≤1, 0→no influence, 1→strong influence, default=1)
-
setPivotInB
Alter the pivot location in B's local coordinates.- Parameters:
location
- the desired location (not null, unaffected)
-
isEnabled
public boolean isEnabled()Test whether this Anchor is enabled.- Specified by:
isEnabled
in classPhysicsJoint
- Returns:
- true
-