Class Anchor

All Implemented Interfaces:
Comparable<NativePhysicsObject>

public class Anchor extends PhysicsJoint
A PhysicsJoint to join a particular node of a soft body (A) to a rigid body (B), based on Bullet's btSoftBody::Anchor.
  • Field Details

    • logger2

      public static final Logger 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

      public Vector3f copyPivot(Vector3f storeResult)
      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

      public PhysicsRigidBody getRigidBody()
      Access the rigid body at the B end.
      Returns:
      the pre-existing body (not null)
    • getSoftBody

      public PhysicsSoftBody 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

      public void setPivotInB(Vector3f location)
      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 class PhysicsJoint
      Returns:
      true