Page 1 of 1

Problem when importing mesh as ground

Posted: Tue Dec 12, 2017 11:40 pm
by yconst
I'm trying to import a mesh to use as ground. I'm using the following code:

Code: Select all

        visualShift = [0, 0, 0]
        shift = [0, 0, -0.1]
        meshScale=[0.1, 0.1, 0.1]
        path = os.path.abspath(os.path.dirname(__file__))
        self.groundColId = p.createCollisionShape(shapeType=p.GEOM_MESH, 
                                                  fileName=os.path.join(path, "ground.obj"), 
                                                  collisionFramePosition=shift,
                                                  meshScale=meshScale)
        self.groundVisID = p.createVisualShape(shapeType=p.GEOM_MESH, 
                                            fileName=os.path.join(path, "ground.obj"), 
                                            rgbaColor=[1,1,1,1],
                                            specularColor=[0.4,.4,0],
                                            visualFramePosition=visualShift,
                                            meshScale=meshScale)
        self.groundId = p.createMultiBody(baseMass=0,
                                              baseInertialFramePosition=[0,0,0],
                                              baseCollisionShapeIndex=self.groundColId, 
                                              baseVisualShapeIndex=self.groundVisID, 
                                              basePosition=[0,0,0], 
                                              useMaximalCoordinates=True)
The imported object looks ok (has bumps as it should) but it seems that the collision shape is flat.
Screen Shot 2017-12-13 at 01.34.17.png
I am not importing anything else apart from this object and the robot seen in the image above.

Is there any mistake I am doing in importing the mesh?

Thank you

Re: Problem when importing mesh as ground

Posted: Wed Dec 13, 2017 2:18 am
by Erwin Coumans
Use the flags=GEOM_FORCE_CONCAVE_TRIMESH in the createCollisionShape command.

Re: Problem when importing mesh as ground

Posted: Wed Dec 13, 2017 9:49 am
by yconst
That did the trick, thanks!