absolutePositionOf method

Vector2 absolutePositionOf(
  1. Vector2 point
)
inherited

Convert local coordinates of a point point inside the component into the global (world) coordinate space.

Implementation

Vector2 absolutePositionOf(Vector2 point) {
  var parentPoint = positionOf(point);
  var ancestor = parent;
  while (ancestor != null) {
    if (ancestor is PositionComponent) {
      parentPoint = ancestor.positionOf(parentPoint);
    }
    ancestor = ancestor.parent;
  }
  return parentPoint;
}