예제 #1
0
        def near_callback(self, args, geom1, geom2):

            # Check if the objects do collide
            contacts = ode.collide(geom1, geom2)

            # Create contact joints
            self.world,self.contactgroup = args
            for c in contacts:
                c.setMode(ode.ContactBounce)
                c.setBounce(0.2)
                c.setBounceVel(0.15)
                c.setMu(250.0)
                j = ode.ContactJoint(self.world, self.contactgroup, c)
                j.attach(geom1.getBody(), geom2.getBody())
예제 #2
0
    def _nearcb(self, args, geom1, geom2):
        """
        Create contact joints between colliding geoms.
        """

        body1, body2 = geom1.getBody(), geom2.getBody()
        if (body1 is None):
            body1 = ode.environment
        if (body2 is None):
            body2 = ode.environment

        if (ode.areConnected(body1, body2)):
            return

        contacts = ode.collide(geom1, geom2)

        for c in contacts:
            c.setBounce(0.2)
            c.setMu(10000)
            j = ode.ContactJoint(self.world, self._cjoints, c)
            j.attach(body1, body2)