コード例 #1
0
ファイル: __init__.py プロジェクト: cullophid/Scienceman
 def __init__(self, a, b, anchr1, anchr2):
     """a and b are the two bodies to connect, and anchr1 and anchr2 are the
     anchor points on those bodies.
     """
     self._a = a
     self._b = b
     self._joint = cp.cpPinJointNew(a._body, b._body, anchr1, anchr2)
コード例 #2
0
    def __init__(self, a, b, anchr1=(0,0), anchr2=(0,0)):
        """a and b are the two bodies to connect, and anchr1 and anchr2 are the
        anchor points on those bodies.
        """

        self._constraint = cp.cpPinJointNew(a._body, b._body, anchr1, anchr2)
        self._ccontents = self._constraint.contents
        self._pjc = cp.cast(self._constraint, ct.POINTER(cp.cpPinJoint)).contents
        self._a = a
        self._b = b
コード例 #3
0
ファイル: constraint.py プロジェクト: sdp-2011/sdp-9
    def __init__(self, a, b, anchr1, anchr2):
        """a and b are the two bodies to connect, and anchr1 and anchr2 are the
        anchor points on those bodies.
        """

        self._constraint = cp.cpPinJointNew(a._body, b._body, anchr1, anchr2)
        self._ccontents = self._constraint.contents
        self._pjc = cp.cast(self._constraint,
                            ct.POINTER(cp.cpPinJoint)).contents
        self._a = a
        self._b = b
コード例 #4
0
    def get_initial_state(self):
        # return first state
        self.space = space = cp.cpSpaceNew()
        space.contents.gravity = vec2d(0.0, -900.0)

	space.contents.damping = 0.01
        cp.cpSpaceResizeStaticHash(space, 50.0, 200)
        cp.cpSpaceResizeActiveHash(space, 50.0, 10)

        self.ball = ball = Ball(space, 5, 10, pos=(310, 180))
        self.floor = Wall(space, (-60000,40), (60000,40))
        self.base = base = Box(space, 5, 50, 20, (300,100))
        cp.cpResetShapeIdCounter()
        joint = cp.cpPinJointNew(
            ball.body, base.body, vec2d(0,0), vec2d(0,0)
            )
	self.save_angle()
        cp.cpSpaceAddJoint(space, joint)
        if self.rl.episodes%100==0:
            self.save()
        return self.get_state()