jtmzheng / 3dss

2 stars 0 forks source link

ConvexHullShape #31

Open jtmzheng opened 10 years ago

jtmzheng commented 10 years ago

Real problem for models that don't match well with convex hulls (anything with a hole)

Probable solution http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Collision_Shapes http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shapes/BvhTriangleMeshShape.html

araghava commented 10 years ago

That shape won't allow for moving objects, we'll have to use a CompoundShape:

http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shapes/CompoundShape.html

Problem is, that's built with several CollisionShapes (convex)... so this might end up being a lot of work because it doesn't seem like JBullet can split it up for us :(

araghava commented 10 years ago

Proposing a solution: Use the "groups" in .obj files. We can create a map of groups -> faces then create ConvexHullShapes for each group, and add them all to a CompoundShape for the whole object. We will still have the whole Material->Faces map for texturing, the groups->faces map would just be for splitting our shape up.

jtmzheng commented 10 years ago

Based on your suggestion for simplifying the convex hull, I would run that and then store the vertices in a Serializable object and write that to a specified directory in the .ini file (eg) models/gen). Use an extension like .physics with the same file name as the .obj file. Then you can make a "Generator Client" that basically loads in the models and creates the simplified physics model. Then when the actual client is run, it can either a) run the algorithm itself if it doesn't find the specified .physics file or b) just load in the .physics file and use those vertices.