Class VehicleCollisionTester

All Implemented Interfaces:
ConstJoltPhysicsObject, ConstVehicleCollisionTester, RefTarget, AutoCloseable, Comparable<JoltPhysicsObject>
Direct Known Subclasses:
VehicleCollisionTesterCastCylinder, VehicleCollisionTesterCastSphere, VehicleCollisionTesterRay

public class VehicleCollisionTester extends NonCopyable implements ConstVehicleCollisionTester, RefTarget
Detect collisions between vehicle wheels and the environment.
  • Method Details

    • setBodyFilter

      public void setBodyFilter(BodyFilter filter)
      Replace the body filter.
      Parameters:
      filter - the desired filter, or null for none (default=null)
    • setBroadPhaseLayerFilter

      public void setBroadPhaseLayerFilter(BroadPhaseLayerFilter filter)
      Replace the broadphase-layer filter.
      Parameters:
      filter - the desired filter, or null for none (default=null)
    • setObjectLayer

      public void setObjectLayer(int objectLayer)
      Replace the object layer used for collision detection when no filters are overridden.
      Parameters:
      objectLayer - the index of the desired layer (default=-1)
    • setObjectLayerFilter

      public void setObjectLayerFilter(ObjectLayerFilter filter)
      Replace the object-layer filter.
      Parameters:
      filter - the desired filter, or null for none (default=null)
    • setVirtualAddressAsCoOwner

      protected final void setVirtualAddressAsCoOwner(long testerVa)
      Assign a native object (assuming there's none already assigned) and designate the JVM object as a co-owner.
      Parameters:
      testerVa - the virtual address of the native object to assign (not zero)
    • getBodyFilter

      public BodyFilter getBodyFilter()
      Access the body filter. The tester is unaffected.
      Specified by:
      getBodyFilter in interface ConstVehicleCollisionTester
      Returns:
      a new JVM object with the pre-existing native object assigned, or null if none
    • getBroadPhaseLayerFilter

      public BroadPhaseLayerFilter getBroadPhaseLayerFilter()
      Access the broadphase-layer filter. The tester is unaffected.
      Specified by:
      getBroadPhaseLayerFilter in interface ConstVehicleCollisionTester
      Returns:
      a new JVM object with the pre-existing native object assigned, or null if none
    • getObjectLayer

      public int getObjectLayer()
      Return the object layer used for collision detection when no filters are overridden. The tester is unaffected.
      Specified by:
      getObjectLayer in interface ConstVehicleCollisionTester
      Returns:
      the index of the layer
    • getObjectLayerFilter

      public ObjectLayerFilter getObjectLayerFilter()
      Access the object-layer filter. The tester is unaffected.
      Specified by:
      getObjectLayerFilter in interface ConstVehicleCollisionTester
      Returns:
      a new JVM object with the pre-existing native object assigned, or null if none
    • getRefCount

      public int getRefCount()
      Count the active references to the native VehicleCollisionTester. The tester is unaffected.
      Specified by:
      getRefCount in interface RefTarget
      Returns:
      the count (≥0)
    • setEmbedded

      public void setEmbedded()
      Mark the native VehicleCollisionTester as embedded.
      Specified by:
      setEmbedded in interface RefTarget
    • toRef

      public Ref toRef()
      Create a counted reference to the current tester.
      Specified by:
      toRef in interface RefTarget
      Returns:
      a new JVM object with a new native object assigned