Box and collideWith() function

What do i have to do to get player(A simple box) working with the collodewith function?





[java]

Box Player = new Box( new Vector3f(0,0,0),0.5f,0.5f,0.5f);

Geometry blue = new Geometry("Player", Player);

Material mat1 = new Material(assetManager,

"Common/MatDefs/Misc/Unshaded.j3md");

mat1.setColor("Color", ColorRGBA.Blue);

blue.setMaterial(mat1);



BoundingVolume box = red.getWorldBound();

BoundingVolume player_box = blue.getWorldBound();

player_box.collideWith(box,results);[/java]



I can only get the pivot in the box to work with collideWith. :frowning:

What didn’t “work”? Read the manual,.

1 Like

Sorry





I intended to use player(A box) with the function collideWith() so i could know what the box hits so i can move start moving it to another part of the world.

Instead i got this error:

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

com.jme3.collision.UnsupportedCollisionException: With: BoundingBox

at com.jme3.bounding.BoundingBox.collideWith(BoundingBox.java:775)




I’m using SDK3.0 beta on vista.



How do “convert” or prepare my box to work with the collidewith function?

@glaucomardano said:
What didn't "work"? Read the manual,.

OMG @Normen, you must be so proud of him right now....now he's sporadically RTFMing people :oOo
2 Likes

:smiley:

1 Like

Ok, but about the error, the output tells EVERYTHING you need xD.

com.jme3.collision.UnsupportedCollisionException: With: BoundingBox


Just call the collideWith() from Spatials.
1 Like

It worked, thanks again. : )

i log in just to vote for you nehon ^^

@nehon said:
OMG @Normen, you must be so proud of him right now....now he's sporadically RTFMing people :o Oo

xD ...reading educates ^^
1 Like

So bounding boxes cannot collide with other bounding boxes? Maybe we should add that

1 Like