OSDN Git Service

[added] RayCastCallback
authorbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Wed, 22 Dec 2010 14:45:49 +0000 (14:45 +0000)
committerbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Wed, 22 Dec 2010 14:45:49 +0000 (14:45 +0000)
gdx/src/com/badlogic/gdx/physics/box2d/RayCastCallback.java [new file with mode: 0644]

diff --git a/gdx/src/com/badlogic/gdx/physics/box2d/RayCastCallback.java b/gdx/src/com/badlogic/gdx/physics/box2d/RayCastCallback.java
new file mode 100644 (file)
index 0000000..5f48480
--- /dev/null
@@ -0,0 +1,27 @@
+package com.badlogic.gdx.physics.box2d;\r
+\r
+import com.badlogic.gdx.math.Vector2;\r
+\r
+/**\r
+ * Callback class for ray casts.\r
+ * @see World#RayCast(RayCastCallback, Vector2, Vector2)\r
+ * @author mzechner\r
+ *\r
+ */\r
+\r
+public interface RayCastCallback {\r
+       \r
+       /** Called for each fixture found in the query. You control how the ray cast\r
+                proceeds by returning a float:\r
+                return -1: ignore this fixture and continue\r
+                return 0: terminate the ray cast\r
+                return fraction: clip the ray to this point\r
+                return 1: don't clip the ray and continue\r
+                @param fixture the fixture hit by the ray\r
+                @param point the point of initial intersection\r
+                @param normal the normal vector at the point of intersection\r
+                @return -1 to filter, 0 to terminate, fraction to clip the ray for\r
+                closest hit, 1 to continue\r
+        **/\r
+       public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction);\r
+}\r