blob: 951ef0ea5d82e49281ca8b3d65186e8b0cd2e8cf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/* _____ _ __ ________ ___ *\
** / ___/(_) |/ / ___/ |__ \ Simple Mechanics Simulator 2 **
** \__ \/ / /|_/ /\__ \ __/ / copyright (c) 2011 Jakob Odersky **
** ___/ / / / / /___/ / / __/ **
** /____/_/_/ /_//____/ /____/ **
\* */
package sims.collision
import sims.math._
/** A base trait for all collidable objects. */
trait Collidable extends AnyRef {
/** Returns an axis aligned box, bounding this collidable object. */
def aabb: AABB
/** Projects this collidable object onto the given axis. */
def project(axis: Vector2D): Projection
/** Checks if the point `point` is contained in this collidable object. */
def contains(point: Vector2D): Boolean
/** Returns the farthest vertex of this collidable in the given direction. */
def support(direction: Vector2D): Vector2D
/** A fixed collidable object cannot collide with other fixed collidable objects.
* This is useful in improving collision detection performance, since a pair of fixed objects will
* be eliminated in the broadphase. */
def fixed = false
}
|