Example #1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.hw = hw = self.width / 2
        self.hh = hh = self.height / 2
        self.radius = hypot(hw, hh)  # circumcircle; for collision detection
        self.inradius = min(hw, hh)  # incircle; for collision detection

        self._relations = []
Example #2
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     import scenic.syntax.veneer as veneer  # TODO improve?
     veneer.registerObject(self)
     self.hw = hw = self.width / 2
     self.hh = hh = self.height / 2
     self.radius = hypot(hw, hh)  # circumcircle; for collision detection
     self.inradius = min(hw, hh)  # incircle; for collision detection
     self.left = self.relativePosition(-hw, 0)
     self.right = self.relativePosition(hw, 0)
     self.front = self.relativePosition(0, hh)
     self.back = self.relativePosition(0, -hh)
     self.frontLeft = self.relativePosition(-hw, hh)
     self.frontRight = self.relativePosition(hw, hh)
     self.backLeft = self.relativePosition(-hw, -hh)
     self.backRight = self.relativePosition(hw, -hh)
     self.corners = (self.frontRight.toVector(), self.frontLeft.toVector(),
                     self.backLeft.toVector(), self.backRight.toVector())
     camera = self.position.offsetRotated(self.heading, self.cameraOffset)
     self.visibleRegion = SectorRegion(camera, self.visibleDistance,
                                       self.heading, self.viewAngle)
     self._relations = []