BoxCollisionShape

'm having trouble with the boxcollisionshape. I’ve made it, and the floor box, but i can’t seem to line them up! I’m following the tutorial involving the initFloor almost to the T (I left out the texturing) and It seems that I have a collision box centered on the spot where the camera begins and double the dimensions of the actual Box… what am I doing wrong?

I’ve since gotten no where on this problem.

[java]

Box wall = new Box(new Vector3f(0f, 5f, (float)MapSize), (float)MapSize, 5f, .5f);

Geometry geomWall = new Geometry(“Wall”, wall);

geomWall.setMaterial(wall_mat);

geomWall.setShadowMode(ShadowMode.Recieve);

wallFinal = new PhysicsNode(new BoxCollisionShape(new Vector3f((float)MapSize, 5f, .5f)));

wallFinal.setLocalTranslation(new Vector3f(0f, 5f, (float)MapSize));

wallFinal.attachChild(geomWall);

rootNode.attachChild(wallFinal);

getPhysicsSpace().add(wallFinal);[/java]

coordinates aside why is my collision where I want the wall, and my wall graphic off behind the wall and up a little (i know this has something to do with the translation.)

Try adding wallFinal.attachDebugShape(assetManager); after line 7

What I did just now was changed it to;

[java] Box wall = new Box(Vector3f.ZERO, (float) MapSize, 5f, .5f);

Geometry geomWall = new Geometry(“Wall”, wall);

wall.scaleTextureCoordinates(new Vector2f(2f, 2f));

geomWall.setMaterial(wall_mat);

geomWall.setShadowMode(ShadowMode.Recieve);

wallFinal = new PhysicsNode(geomWall, new BoxCollisionShape(new Vector3f((float) MapSize, 5f, .5f)), 0);

wallFinal.setLocalTranslation(new Vector3f(0f, 5f, (float) MapSize));

rootNode.attachChild(wallFinal);

getPhysicsSpace().add(wallFinal);[/java]



So i basically create the collision box and the graphical box at the origin, attached together, and then translate them. I kept thinking of it sequentially in my head and starting the graphical box in it’s position and then trying to create a collision, move it there, and attach it.



PS Now I need to look into generating nice rocky/jagged walls instead of all these smooth boring panel-like one I have, any good tools for that?

NeoTextureEditor, it will also be added to jMP soon.