Class AllHitCallback
java.lang.Object
com.csse3200.game.physics.raycast.AllHitCallback
- All Implemented Interfaces:
com.badlogic.gdx.physics.box2d.RayCastCallback
public class AllHitCallback
extends Object
implements com.badlogic.gdx.physics.box2d.RayCastCallback
Cast a ray against all colliders that match the layer mask. All hits will be stored, with an
empty array if no hits occurred.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets all raycast hits and clears the internal hit list.short
float
reportRayFixture
(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Vector2 point, com.badlogic.gdx.math.Vector2 normal, float fraction) void
setLayerMask
(short layerMask)
-
Constructor Details
-
AllHitCallback
public AllHitCallback()Creates a new AllHitCallback with default settings.
-
-
Method Details
-
getHitsAndClear
Gets all raycast hits and clears the internal hit list.- Returns:
- array of all raycast hits
-
setLayerMask
public void setLayerMask(short layerMask) -
getLayerMask
public short getLayerMask() -
reportRayFixture
public float reportRayFixture(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Vector2 point, com.badlogic.gdx.math.Vector2 normal, float fraction) - Specified by:
reportRayFixture
in interfacecom.badlogic.gdx.physics.box2d.RayCastCallback
-