Ok, i bet that this is a bug, or i lost tens of I.Q. points during my sleep and i can’t understand simple things.
First, I have problems with the physic PhysicsRayTestResult.
First of all (for you, not for me) i have this javadoc page.
http://hub.jmonkeyengine.org/javadoc/com/jme3/bullet/collision/PhysicsRayTestResult.html
Where you have the description :
Contains the results of a PhysicsSpace rayTest bulletAppState.getPhysicsSpace().rayTest(new Vector3f(0,1000,0),new Vector3f(0,-1000,0)); javap -s java.util.List
Well, i think that this is just a “normal” bug. But, when i looked into an other javadoc page here:
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/jbullet/com/jme3/bullet/collision/PhysicsRayTestResult.java
You have this:
Contains the results of a PhysicsSpace rayTest. * <b>Read data only in callback method, object is reused</b>It seems to make much more sense but ... where can i put this "callback" method ? There is nothing like that in this class, and nothing in the PhysicsSpace.rayTest either. I tried to extend the ArrayList and print the result when the object is added to the collection (well, it could be understand as a callback method) but nothing change.
Oh wait, i didn’t explain my problem yet, so :
the normal seems to be f*** up. I get results like (0.0, 360.0, 0.0), (-99.0, 0.0, 0.0) (30.0, 0.0, 0.0)
or even (30.0, -0.0, 0.0) oh yeah
As you can see, none of them are normalized (which is already a problem, but not a that big one). But, the real problem is that i got these results when i was shooting at walls, so rays collides with walls to give me this. These walls are straight, vertical walls, and corners between them are 90°, it’s really a standard room. But i get collisions that are only along the y axis.
So, either i am stupid or this is a bug. And if it’s a bug, how can i fix this ? I want to give a proper initial speed direction to my sparks when a bullet hit the wall, and i also need it to turn the bullet hole in the right direction.
I guessed that is has something to do with the original ray direction, but it seems that the orientation of the camera (and of the gun) doesn’t make a difference.
Thanks for help