[Solved]I keep getting an UnsupportedCollisionException and am not sure why

Hey everyone,



So I’m trying to implement some collision detection without physics. To my current understanding, this is entirely possible (I used the HelloPicking tutorial to help me with a lot of this code).



Anyways, this is what I have.

[java]spatial.updateGeometricState();

CollisionResults results = new CollisionResults();

spatial.collideWith(lrPaddles, results);

if (results.size() > 0)

velocity.setX(-velocity.getX());



spatial.collideWith(tbPaddles, results);

if (results.size() > 0)

velocity.setY(-velocity.getY());[/java]



This resides in the controlUpdate(tpf) method of a custom Control class. When I run the code, it gives me

com.jme3.collision.UnsupportedCollisionException

at com.jme3.collision.bih.BIHTree.collideWith(BIHTree.java:479)

at com.jme3.scene.Mesh.collideWith(Mesh.java:479)

at com.jme3.scene.Geometry.collideWith(Geometry.java:232)

at pong.ControlBall.controlUpdate(ControlBall.java:41)

at com.jme3.scene.control.AbstractControl.update(AbstractControl.java:88)

at com.jme3.scene.Spatial.runControlUpdate(Spatial.java:502)

at com.jme3.scene.Spatial.updateLogicalState(Spatial.java:619)

at com.jme3.scene.Node.updateLogicalState(Node.java:153)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:209)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:144)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:141)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:198)

at java.lang.Thread.run(Thread.java:636)




So what am I doing wrong? My best guess is that I can’t pass a Node object to collideWith, but that’s done in HelloPicking.



Thanks for any help,

mtheoryninja

You can only collide geometry vs Bounding Volumes or Rays, like rootNode.collideWith(volume/ray).

Ah okay, so can I turn it around and say lrPaddles.collideWith(spatial, results) ? (I’m going to try this now; not sure why I’m typing this).



just tried it

So that doesn’t work…Am I missing something? With regard to collision, isn’t rootNode basically the same as any other node? So when I say lrPaddles (which is a node) collides with spatial (A Geometry), shouldn’t that then work? Or are Bounding Volumes not the same as Geometries?



I guess I’m just a little confused. Maybe I need to look at the HelloPicking code more closely.



Thanks for any further clarification



Edit:

So I’m currently trying the above code with the exception that I’m saying spatial.getWorldBound() which returns a BoundingVolume.

just tried it

SUCCESS. So I need the BV not the Geom. Okay, I’m getting the hang of this jME stuff.



Thanks.