What is the best way to go about making a detailed environment and a simplified collision mesh for it? Say for example I have a detailed staircase, but I want a simple plane to represent where the character can walk up it.
Would I:
In Blender, create the environment as one object
in Blender, create an object to represent the collision on top of it
Export the environment object
Export the collision object
Load both models, using the collision egg for collision things, but hiding the collision model
?
That’s what I’ve been doing so far, but I’m just starting a really detailed map and don’t want to get too far doing things the wrong way. Also, in the collision egg, I’ve specified one part of it as the wall, and the other as the floor (for the pusher and floor collision handlers). All of the modeling is done in blender.
What should I do about parts of the environment that have the same location as the collision part? (i.e. with the staircase example, it is easy to differentiate the stairs from the plane while I am creating it; however, the collision for the side of a building will be exactly the same as it’s visual model.
My code for setting up the collision goes like this:
# Load the collision model and hide it
self.collisionModel = loader.loadModel("maps/TestMapCollision")
self.collisionModel.reparentTo(render)
self.collisionModel.hide()
self.collisionModel.setCollideMask(BitMask32.allOff())
# Get the parts of the environment that are collidable
self.walls = self.collisionModel.find("**/wall")
self.floors = self.collisionModel.find("**/floor")
# Mark them as things you can collide into
self.floorMask = BitMask32.bit(FLOOR_BITMASK)
self.wallMask = BitMask32.bit(WALL_BITMASK)
self.walls.node().setIntoCollideMask(self.wallMask)
self.floors.node().setIntoCollideMask(self.floorMask)
# Load the visible environment
self.model = loader.loadModel("maps/TestMap")
self.model.reparentTo(render)