class Eagle::Physics2D::Circle

Overview

A circle collision shape.

Physics2D::Circle.new(16)
Physics2D::Circle.new(8, offset: v2(0, -20)) # a head above the body's origin

Defined in:

eagle/physics/shapes2d.cr

Constructors

Instance Method Summary

Instance methods inherited from class Eagle::Physics2D::Shape

aabb : Rect aabb, area : Float32 area, inertia_factor : Float32 inertia_factor, local_aabb : Rect local_aabb, offset : Vec2 offset, offset=(offset : Vec2) offset=, transformed(t : Transform2D) : Shape transformed

Constructor Detail

def self.new(radius : Number, offset : Vec2 = Vec2::ZERO) #

Creates a circle of radius, offset from the body's origin.


Instance Method Detail

def aabb : Rect #

Bounds in world space.


def area : Float32 #

Area of the circle.


def center : Vec2 #

Center in world space, on transformed shapes.


def center=(center : Vec2) #

Center in world space, on transformed shapes.


def contains?(p : Vec2) : Bool #

True when p is inside the circle.


def inertia_factor : Float32 #

Inertia per unit mass.


def local_aabb : Rect #

Bounds in local space.


def radius : Float32 #

Radius in pixels.


def radius=(radius : Float32) #

Radius in pixels.


def transformed(t : Transform2D) : Shape #

A world-space copy.