Remove Collision from an entire MultiBody
Posted: Thu Feb 07, 2019 10:18 pm
Hi,
i have a certain number of random generated MultiBody with multiple links BUT i dont want them to collide beteen them and i also want them to keep colliding with my main plane floor.
I find a solution but it works only on the body of the multy body not on the links. Part of the problem is : i dont know what is the LinkIndex parameter in the setCollisionFilterGroupMask function.
My code at the moment :
i have a certain number of random generated MultiBody with multiple links BUT i dont want them to collide beteen them and i also want them to keep colliding with my main plane floor.
I find a solution but it works only on the body of the multy body not on the links. Part of the problem is : i dont know what is the LinkIndex parameter in the setCollisionFilterGroupMask function.
My code at the moment :
Code: Select all
p.createCollisionShape(p.GEOM_PLANE)
basePlan = p.createMultiBody(0, 0)
nbobj = 5
body = p.createCollisionShape(p.GEOM_SPHERE, radius=1)
body2 = p.createCollisionShape(p.GEOM_SPHERE, radius=0.5)
aShape = s.Shape(body, pos1)
aShape2 = s.Shape(body2, pos1)
# intitialize multibody matrix for "nbobj" new link
aShape.createRandom(nbobj)
aShape2.createRandom(nbobj)
# do the createMultiBody and return the UniqueBodyid
shape = aShape.createBody()
shape2 = aShape2.createBody()
# Do shape to not collide
p.setCollisionFilterGroupMask(shape, -1, 0, 0)
p.setCollisionFilterGroupMask(shape2, -1, 0, 0)
# But enable the floor Collision
p.setCollisionFilterPair(basePlane, shape, -1, -1, 1)
p.setCollisionFilterPair(basePlane, shape2, -1, -1, 1)