I’m trying to write a .collideWith method that returns a new CollisionResult containing my class instead of a Geometry. Where can I find the class that actually does the collision calculations between a ray and geometry and returns the geometry? Once I find that it should be a simple matter of defining the geometry as myClass.getGeometry() instead.
Why dont you just make your class so that it takes a CollisionResult in its constructor and then exposes whatever functionality you want? So you go “new MyClass(getCollisionResult(0)).doStuff()”
What I want to do is have the CollisionResult return an instance of my class so I can do the instance’s methods directly. The CollisionResult only contains a geometry, not the class, so to avoid matching the geometry to the instance by name I have to make my own CollisionResult. Otherwise, for example, if I want to do a Soldier.java’s damage class I have to check for collisions with its geometry and then do a really stupid search through every instance comparing the geometry’s name string, which is horribly inefficient. Or else there’s a better way I’m unaware of.
You would just compare the one spatial with the list of soldier spatials that you have somewhere, you could also use a number stored in the UserData to identify the single entities. Overriding or extending classes of jme3 is mostly not the right way of thinking.
By the way, what did you use to export Sinbad from Blender for the test classes? When I try with my exporter I always get problems because of the vertices mapped to more than 4 bones.