Here is a propsed patch.
I added some documentation for the public float getHitFraction()
I noticed that class PhysicsRayTestResult and class PhysicsSweepTestResult were identical so I created an abstract parent class and pulled up methods and members.
edit: changed the markup to ‘patch’.
[patch]
This patch file was generated by NetBeans IDE
Index: AbstractTestResult.java
— AbstractTestResult.java Locally New
+++ AbstractTestResult.java Locally New
@@ -0,0 +1,92 @@
+/*
-
- Copyright © 2009-2012 jMonkeyEngine
- Copyright © 2009-2012 jMonkeyEngine
-
- All rights reserved.
- All rights reserved.
- *
-
- Redistribution and use in source and binary forms, with or without
- Redistribution and use in source and binary forms, with or without
-
- modification, are permitted provided that the following conditions are
- modification, are permitted provided that the following conditions are
-
- met:
- met:
- *
-
-
- Redistributions of source code must retain the above copyright
- Redistributions of source code must retain the above copyright
-
-
- notice, this list of conditions and the following disclaimer.
- notice, this list of conditions and the following disclaimer.
- *
-
-
- Redistributions in binary form must reproduce the above copyright
- Redistributions in binary form must reproduce the above copyright
-
-
- notice, this list of conditions and the following disclaimer in the
- notice, this list of conditions and the following disclaimer in the
-
- documentation and/or other materials provided with the distribution.
- documentation and/or other materials provided with the distribution.
- *
-
-
- Neither the name of ‘jMonkeyEngine’ nor the names of its contributors
- Neither the name of ‘jMonkeyEngine’ nor the names of its contributors
-
-
- may be used to endorse or promote products derived from this software
- may be used to endorse or promote products derived from this software
-
- without specific prior written permission.
- without specific prior written permission.
- *
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+package com.jme3.bullet.collision;
+
+import com.jme3.math.Vector3f;
+
+/**
-
- Contains the result of a collision sweep (or ray) test.
- Contains the result of a collision sweep (or ray) test.
-
-
@author Johan Maasing <johan@zoom.nu>
-
@author Johan Maasing <johan@zoom.nu>
- */
+public abstract class AbstractTestResult {
+
- private PhysicsCollisionObject collisionObject;
- private Vector3f hitNormalLocal;
- private float hitFraction;
- private boolean normalInWorldSpace;
+
- public AbstractTestResult(PhysicsCollisionObject collisionObject, Vector3f hitNormalLocal, float hitFraction, boolean normalInWorldSpace) {
-
this.collisionObject = collisionObject;<br />
-
this.hitNormalLocal = hitNormalLocal;<br />
-
this.hitFraction = hitFraction;<br />
-
this.normalInWorldSpace = normalInWorldSpace;<br />
- }
+
- /**
-
* @return the collisionObject<br />
-
*/<br />
- public PhysicsCollisionObject getCollisionObject() {
-
return collisionObject;<br />
- }
+
- /**
-
* @return the hitNormalLocal<br />
-
*/<br />
- public Vector3f getHitNormalLocal() {
-
return hitNormalLocal;<br />
- }
+
- /**
-
* Get the fraction of the sweep where the collision occured. You can use<br />
-
* the hitFraction value to determine on what distance of the given sweep<br />
-
* length the collision happened. E.g. when the hitFraction is 0.5 and you<br />
-
* sweeped from 0,0,0 to 0,6,0 then the hit position was at 0,3,0<br />
-
* @return the hitFraction<br />
-
*/<br />
- public float getHitFraction() {
-
return hitFraction;<br />
- }
+
- /**
-
* @return the normalInWorldSpace<br />
-
*/<br />
- public boolean isNormalInWorldSpace() {
-
return normalInWorldSpace;<br />
- }
+
- public void fill(PhysicsCollisionObject collisionObject, Vector3f hitNormalLocal, float hitFraction, boolean normalInWorldSpace) {
-
this.collisionObject = collisionObject;<br />
-
this.hitNormalLocal = hitNormalLocal;<br />
-
this.hitFraction = hitFraction;<br />
-
this.normalInWorldSpace = normalInWorldSpace;<br />
- }
+}
Index: PhysicsRayTestResult.java
— PhysicsRayTestResult.java Base (BASE)
+++ PhysicsRayTestResult.java Locally Modified (Based On LOCAL)
@@ -33,59 +33,15 @@
import com.jme3.math.Vector3f;
+
/**
- Contains the results of a PhysicsSpace rayTest
-
@author normenhansen
*/
-public class PhysicsRayTestResult {
+public class PhysicsRayTestResult extends AbstractTestResult {
- private PhysicsCollisionObject collisionObject;
- private Vector3f hitNormalLocal;
- private float hitFraction;
- private boolean normalInWorldSpace;
-
- public PhysicsRayTestResult() {
- }
-
public PhysicsRayTestResult(PhysicsCollisionObject collisionObject, Vector3f hitNormalLocal, float hitFraction, boolean normalInWorldSpace) {
-
this.collisionObject = collisionObject;<br />
-
this.hitNormalLocal = hitNormalLocal;<br />
-
this.hitFraction = hitFraction;<br />
-
this.normalInWorldSpace = normalInWorldSpace;<br />
-
super(collisionObject, hitNormalLocal, hitFraction, normalInWorldSpace);<br />
}
- /**
-
* @return the collisionObject<br />
-
*/<br />
- public PhysicsCollisionObject getCollisionObject() {
-
return collisionObject;<br />
}
-
- /**
-
* @return the hitNormalLocal<br />
-
*/<br />
- public Vector3f getHitNormalLocal() {
-
return hitNormalLocal;<br />
- }
-
- /**
-
* @return the hitFraction<br />
-
*/<br />
- public float getHitFraction() {
-
return hitFraction;<br />
- }
-
- /**
-
* @return the normalInWorldSpace<br />
-
*/<br />
- public boolean isNormalInWorldSpace() {
-
return normalInWorldSpace;<br />
- }
-
- public void fill(PhysicsCollisionObject collisionObject, Vector3f hitNormalLocal, float hitFraction, boolean normalInWorldSpace) {
-
this.collisionObject = collisionObject;<br />
-
this.hitNormalLocal = hitNormalLocal;<br />
-
this.hitFraction = hitFraction;<br />
-
this.normalInWorldSpace = normalInWorldSpace;<br />
- }
-}
Index: PhysicsSweepTestResult.java
— PhysicsSweepTestResult.java Base (BASE)
+++ PhysicsSweepTestResult.java Locally Modified (Based On LOCAL)
@@ -37,55 +37,10 @@
- Contains the results of a PhysicsSpace rayTest
-
@author normenhansen
*/
-public class PhysicsSweepTestResult {
+public class PhysicsSweepTestResult extends AbstractTestResult {
- private PhysicsCollisionObject collisionObject;
- private Vector3f hitNormalLocal;
- private float hitFraction;
- private boolean normalInWorldSpace;
-
- public PhysicsSweepTestResult() {
- }
-
public PhysicsSweepTestResult(PhysicsCollisionObject collisionObject, Vector3f hitNormalLocal, float hitFraction, boolean normalInWorldSpace) {
-
this.collisionObject = collisionObject;<br />
-
this.hitNormalLocal = hitNormalLocal;<br />
-
this.hitFraction = hitFraction;<br />
-
this.normalInWorldSpace = normalInWorldSpace;<br />
-
super(collisionObject, hitNormalLocal, hitFraction, normalInWorldSpace);<br />
}
- /**
-
* @return the collisionObject<br />
-
*/<br />
- public PhysicsCollisionObject getCollisionObject() {
-
return collisionObject;<br />
}
-
- /**
-
* @return the hitNormalLocal<br />
-
*/<br />
- public Vector3f getHitNormalLocal() {
-
return hitNormalLocal;<br />
- }
-
- /**
-
* @return the hitFraction<br />
-
*/<br />
- public float getHitFraction() {
-
return hitFraction;<br />
- }
-
- /**
-
* @return the normalInWorldSpace<br />
-
*/<br />
- public boolean isNormalInWorldSpace() {
-
return normalInWorldSpace;<br />
- }
-
- public void fill(PhysicsCollisionObject collisionObject, Vector3f hitNormalLocal, float hitFraction, boolean normalInWorldSpace) {
-
this.collisionObject = collisionObject;<br />
-
this.hitNormalLocal = hitNormalLocal;<br />
-
this.hitFraction = hitFraction;<br />
-
this.normalInWorldSpace = normalInWorldSpace;<br />
- }
-}
[/patch]