示例#1
0
 def rotate(self, angle=math.pi, center=Point.origin()):
     """Rotate the point using an angle and the point of rotation."""
     self.abstract.rotate(angle, center)
     point = self.abstract
     point.rotate(angle, center)
     vector = Vector.createFromPoint(point)
     self.motion.setPosition(vector)
示例#2
0
    def onCollision(self, point):
        """React to a physical collision between two objects using the material point of collision."""
        vector = Vector.createFromPoint(point)
        a = vector.angle()
        v1 = self.motion.getVelocity()
        v2 = point.motion.getVelocity()
        v1.rotate()

        pm = point.mass
        px, py = point.position