Class cocos.collision_model.AARectShape

Implements the Cshape interface that uses rectangles with sides paralell to the coordinate axis as geometric shape.

Distance is not the euclidean distance but the rectangular or max-min distance, max( min(x0 - x1), min(y0 - y1) : (xi, yi) in recti )

Good if actors don't rotate.

Look at Cshape for other class and methods documentation.

Methods

  __init__(self, center, half_width, half_height)
  overlaps(self, other)
  distance(self, other)
  near_than(self, other, near_distance)
  touches_point(self, x, y)
  fits_in_box(self, packed_box)
  minmax(self)
  copy(self)

Method Details

__init__

(Constructor) __init__(self, center, half_width, half_height)
Parameters:
center : euclid.Vector2
rectangle center
half_width : float
half width of rectangle
half_height : float
half height of rectangle