Boundingbox for milkshape model

I like to add a bouding box to a milkshape model to help detect collision with the model but dont see how it can be done.



The model loader doesnt offer any method to do this but it has a method called setWorldBound. Can this be used to set a bounding box which can be used for collision detection?

tomcat


Geometry g = (Geometry)milkShapeNode.getChild(0);
g.setModelBounds(new BoundingBox());



DP

Check out hte javadoc for setProperty of JmeBinaryReader. There is a "bound","box" option.

Thx DP this

Geometry g = (Geometry)milkShapeNode.getChild(0);

g.setModelBounds(new BoundingBox());

seems to solve the boundingBox problem.


Check out hte javadoc for setProperty of JmeBinaryReader. There is a "bound","box" option.

Cep21, I just realised I am still using the MilkshapeASCIIModel and not the Milk2Jme one. I should really change.

But on a seperate note, I still cant detect collision (I am using CollisionResult). I also checked the Tutorial Guide and couldnt see any tutorial on collision. No references to collision in the whole document. Strange (!)
tomcat

It’s with HelloIntersection and how I tell if the bullet hits the target. It’s just basic detection. Somethig more complicated would require exact triangle detection.

OK, I checked it out. I was keep using CollisionDetection, which I think should work. Checking the tutorial, it seems that you have used Intersection which is called by the collision detection. I will try this method and see if I got any luck.

tomcat

The TestPicking demo should be what you need. It simply loads a Milkshape model, and determines what is being hit by a ray. Should be trivial to convert to normal collision.

Thx Mojo, I checked it out and I think I can make changes to make it work for this.

tomcat