Documentation
¶
Index ¶
- func ToDegrees(radians float64) float64
- func ToRadians(degrees float64) float64
- type Cell
- type Circle
- func (circle *Circle) Bounds() (vector.Vector, vector.Vector)
- func (circle *Circle) Clone() IShape
- func (circle *Circle) Intersection(dx, dy float64, other IShape) *ContactSet
- func (circle *Circle) IntersectionPointsCircle(other *Circle) []vector.Vector
- func (circle *Circle) Move(x, y float64)
- func (circle *Circle) MoveVec(vec vector.Vector)
- func (circle *Circle) PointInside(point vector.Vector) bool
- func (circle *Circle) Position() (float64, float64)
- func (circle *Circle) Radius() float64
- func (circle *Circle) Rotate(radians float64)
- func (circle *Circle) Rotation() float64
- func (circle *Circle) Scale() (float64, float64)
- func (circle *Circle) SetPosition(x, y float64)
- func (circle *Circle) SetPositionVec(vec vector.Vector)
- func (circle *Circle) SetRadius(radius float64)
- func (circle *Circle) SetRotation(rotation float64)
- func (circle *Circle) SetScale(w, h float64)
- type Collision
- func (cc *Collision) ContactWithCell(cell *Cell) vector.Vector
- func (cc *Collision) ContactWithObject(object *Object) vector.Vector
- func (cc *Collision) HasTags(tags ...string) bool
- func (cc *Collision) ObjectsByTags(tags ...string) []*Object
- func (cc *Collision) SlideAgainstCell(cell *Cell, avoidTags ...string) vector.Vector
- type ContactSet
- type ConvexPolygon
- func (cp *ConvexPolygon) AddPoints(vertexPositions ...float64)
- func (cp *ConvexPolygon) AddPointsVec(points ...vector.Vector)
- func (cp *ConvexPolygon) Bounds() (vector.Vector, vector.Vector)
- func (cp *ConvexPolygon) Center() vector.Vector
- func (cp *ConvexPolygon) Clone() IShape
- func (cp *ConvexPolygon) ContainedBy(otherShape IShape) bool
- func (cp *ConvexPolygon) FlipH()
- func (cp *ConvexPolygon) FlipV()
- func (cp *ConvexPolygon) Intersection(dx, dy float64, other IShape) *ContactSet
- func (cp *ConvexPolygon) Lines() []*collidingLine
- func (cp *ConvexPolygon) Move(x, y float64)
- func (cp *ConvexPolygon) MoveVec(vec vector.Vector)
- func (polygon *ConvexPolygon) PointInside(point vector.Vector) bool
- func (cp *ConvexPolygon) Position() (float64, float64)
- func (cp *ConvexPolygon) Project(axis vector.Vector) Projection
- func (cp *ConvexPolygon) ReverseVertexOrder()
- func (polygon *ConvexPolygon) Rotate(radians float64)
- func (polygon *ConvexPolygon) Rotation() float64
- func (cp *ConvexPolygon) SATAxes() []vector.Vector
- func (polygon *ConvexPolygon) Scale() (float64, float64)
- func (cp *ConvexPolygon) SetPosition(x, y float64)
- func (cp *ConvexPolygon) SetPositionVec(vec vector.Vector)
- func (polygon *ConvexPolygon) SetRotation(radians float64)
- func (polygon *ConvexPolygon) SetScale(w, h float64)
- func (cp *ConvexPolygon) Transformed() []vector.Vector
- type IShape
- type Object
- func (obj *Object) AddTags(tags ...string)
- func (obj *Object) AddToIgnoreList(ignoreObj *Object)
- func (obj *Object) Bottom() float64
- func (obj *Object) BoundsToSpace(dx, dy float64) (int, int, int, int)
- func (obj *Object) CellPosition() (int, int)
- func (obj *Object) Center() (float64, float64)
- func (obj *Object) Check(dx, dy float64, tags ...string) *Collision
- func (obj *Object) Clone() *Object
- func (obj *Object) HasTags(tags ...string) bool
- func (obj *Object) Overlaps(other *Object) bool
- func (obj *Object) RemoveFromIgnoreList(ignoreObj *Object)
- func (obj *Object) RemoveTags(tags ...string)
- func (obj *Object) Right() float64
- func (obj *Object) SetBottom(y float64)
- func (obj *Object) SetBounds(topLeft, bottomRight vector.Vector)
- func (obj *Object) SetCenter(x, y float64)
- func (obj *Object) SetRight(x float64)
- func (obj *Object) SetShape(shape IShape)
- func (obj *Object) SharesCells(other *Object) bool
- func (obj *Object) SharesCellsTags(tags ...string) bool
- func (obj *Object) Tags() []string
- func (obj *Object) Update()
- type Projection
- type Space
- func (sp *Space) Add(objects ...*Object)
- func (sp *Space) Cell(x, y int) *Cell
- func (sp *Space) CellsInLine(startX, startY, endX, endY int) []*Cell
- func (sp *Space) CheckCells(x, y, w, h int, tags ...string) *Object
- func (sp *Space) CheckCellsWorld(x, y, w, h float64, tags ...string) *Object
- func (sp *Space) Height() int
- func (sp *Space) Objects() []*Object
- func (sp *Space) Remove(objects ...*Object)
- func (sp *Space) Resize(width, height int)
- func (sp *Space) SpaceToWorld(x, y int) (float64, float64)
- func (sp *Space) UnregisterAllObjects()
- func (sp *Space) Width() int
- func (sp *Space) WorldToSpace(x, y float64) (int, int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cell ¶
type Cell struct {
X, Y int // The X and Y position of the cell in the Space - note that this is in Grid position, not World position.
Objects []*Object // The Objects that a Cell contains.
}
Cell is used to contain and organize Object information.
func (*Cell) Contains ¶
Contains returns whether a Cell contains the specified Object at its position.
func (*Cell) ContainsTags ¶
ContainsTags returns whether a Cell contains an Object that has the specified tag at its position.
type Circle ¶
type Circle struct {
X, Y float64
// contains filtered or unexported fields
}
func NewCircle ¶
NewCircle returns a new Circle, with its center at the X and Y position given, and with the defined radius.
func (*Circle) Intersection ¶
func (circle *Circle) Intersection(dx, dy float64, other IShape) *ContactSet
Intersection tests to see if a Circle intersects with the other given Shape. dx and dy are delta movement variables indicating movement to be applied before the intersection check (thereby allowing you to see if a Shape would collide with another if it were in a different relative location). If an Intersection is found, a ContactSet will be returned, giving information regarding the intersection.
func (*Circle) IntersectionPointsCircle ¶
IntersectionPointsCircle returns the intersection points of the two circles provided.
func (*Circle) PointInside ¶
PointInside returns if the given vector.Vector is inside of the circle.
func (*Circle) Rotate ¶ added in v0.6.0
Circles can't rotate, of course. This function is just a stub to make them acceptable as IShapes.
func (*Circle) Rotation ¶ added in v0.6.0
Circles can't rotate, of course. This function is just a stub to make them acceptable as IShapes.
func (*Circle) Scale ¶ added in v0.6.0
Scale returns the scale multiplier of the Circle, twice; this is to have it adhere to the
func (*Circle) SetPosition ¶
SetPosition sets the center position of the Circle using the X and Y values given.
func (*Circle) SetPositionVec ¶
SetPosition sets the center position of the Circle using the vector.Vector given.
func (*Circle) SetRadius ¶ added in v0.6.0
SetRadius sets the radius of the Circle, updating the scale multiplier to reflect this change.
func (*Circle) SetRotation ¶ added in v0.6.0
Circles can't rotate, of course. This function is just a stub to make them acceptable as IShapes.
type Collision ¶
type Collision struct { Objects []*Object // Slice of objects that were collided with; sorted according to distance to calling Object. Cells []*Cell // Slice of cells that were collided with; sorted according to distance to calling Object. // contains filtered or unexported fields }
Collision contains the results of an Object.Check() call, and represents a collision between an Object and cells that contain other Objects. The Objects array indicate the Objects collided with.
func NewCollision ¶
func NewCollision() *Collision
func (*Collision) ContactWithCell ¶
ContactWithCell returns the delta to move to come into contact with the specified Cell.
func (*Collision) ContactWithObject ¶
ContactWithObject returns the delta to move to come into contact with the specified Object.
func (*Collision) HasTags ¶
HasTags returns whether any objects within the Collision have all of the specified tags. This slice does not contain the Object that called Check().
func (*Collision) ObjectsByTags ¶
ObjectsByTags returns a slice of Objects from the cells reported by a Collision object by searching for Objects with a specific set of tags. This slice does not contain the Object that called Check().
func (*Collision) SlideAgainstCell ¶
SlideAgainstCell returns how much distance the calling Object can slide to avoid a collision with the targetObject. This only works on vertical and horizontal axes (x and y directly), primarily for platformers / top-down games. avoidTags is a sequence of tags (as strings) to indicate when sliding is valid (i.e. if a Cell contains an Object that has the tag given in the avoidTags slice, then sliding CANNOT happen). If sliding is not able to be done for whatever reason, SlideAgainstCell returns nil.
type ContactSet ¶
type ContactSet struct { Points []vector.Vector // Slice of Points indicating contact between the two Shapes. MTV vector.Vector // Minimum Translation Vector; this is the vector to move a Shape on to move it outside of its contacting Shape. Center vector.Vector // Center of the Contact set; this is the average of all Points contained within the Contact Set. }
func NewContactSet ¶
func NewContactSet() *ContactSet
func (*ContactSet) BottommostPoint ¶
func (cs *ContactSet) BottommostPoint() vector.Vector
BottommostPoint returns the bottom-most point out of the ContactSet's Points slice. If the Points slice is empty somehow, this returns nil.
func (*ContactSet) LeftmostPoint ¶
func (cs *ContactSet) LeftmostPoint() vector.Vector
LeftmostPoint returns the left-most point out of the ContactSet's Points slice. If the Points slice is empty somehow, this returns nil.
func (*ContactSet) RightmostPoint ¶
func (cs *ContactSet) RightmostPoint() vector.Vector
RightmostPoint returns the right-most point out of the ContactSet's Points slice. If the Points slice is empty somehow, this returns nil.
func (*ContactSet) TopmostPoint ¶
func (cs *ContactSet) TopmostPoint() vector.Vector
TopmostPoint returns the top-most point out of the ContactSet's Points slice. If the Points slice is empty somehow, this returns nil.
type ConvexPolygon ¶
type ConvexPolygon struct { Points []vector.Vector // Points represents the points constructing the ConvexPolygon. X, Y float64 // X and Y are the position of the ConvexPolygon. ScaleW, ScaleH float64 // The width and height for scaling Closed bool // Closed is whether the ConvexPolygon is closed or not; only takes effect if there are more than 2 points. // contains filtered or unexported fields }
ConvexPolygon represents a series of points, connected by lines, constructing a convex shape. The polygon has a position, a scale, a rotation, and may or may not be closed.
func NewConvexPolygon ¶
func NewConvexPolygon(x, y float64, points ...float64) *ConvexPolygon
NewConvexPolygon creates a new convex polygon at the position given, from the provided set of X and Y positions of 2D points (or vertices). You don't need to pass any points at this stage, but if you do, you should pass whole pairs. The points should generally be ordered clockwise, from X and Y of the first, to X and Y of the last. For example: NewConvexPolygon(30, 20, 0, 0, 10, 0, 10, 10, 0, 10) would create a 10x10 convex polygon square, with the vertices at {0,0}, {10,0}, {10, 10}, and {0, 10}, with the polygon itself occupying a position of 30, 20. Note that the passed values are the positions of the vertices composing the shape, not the position of the shape itself. You can also pass the points using vectors with ConvexPolygon.AddPointsVec().
func NewLine ¶
func NewLine(x1, y1, x2, y2 float64) *ConvexPolygon
NewLine is a helper function that returns a ConvexPolygon composed of a single line. The Polygon has a position of x1, y1, and has a width and height equivalent to x2-x1 and y2-y1 (so the end of the line is at x2, y2).
func NewRectangle ¶
func NewRectangle(x, y, w, h float64) *ConvexPolygon
NewRectangle returns a rectangular ConvexPolygon at the {x, y} position given with the vertices ordered in clockwise order, positioned at {0, 0}, {w, 0}, {w, h}, {0, h}. TODO: In actuality, an AABBRectangle should be its own "thing" with its own optimized Intersection code check.
func (*ConvexPolygon) AddPoints ¶
func (cp *ConvexPolygon) AddPoints(vertexPositions ...float64)
AddPoints allows you to add points to the ConvexPolygon with a slice or selection of float64s, with each pair indicating an X or Y value for a point / vertex (i.e. AddPoints(0, 1, 2, 3) would add two points - one at {0, 1}, and another at {2, 3}).
func (*ConvexPolygon) AddPointsVec ¶
func (cp *ConvexPolygon) AddPointsVec(points ...vector.Vector)
AddPointsVec allows you to add points to the ConvexPolygon with a slice of vector.Vectors, each indicating a point / vertex.
func (*ConvexPolygon) Bounds ¶
func (cp *ConvexPolygon) Bounds() (vector.Vector, vector.Vector)
Bounds returns two Vectors, comprising the top-left and bottom-right positions of the bounds of the ConvexPolygon, post-transformation.
func (*ConvexPolygon) Center ¶
func (cp *ConvexPolygon) Center() vector.Vector
Center returns the transformed Center of the ConvexPolygon.
func (*ConvexPolygon) Clone ¶
func (cp *ConvexPolygon) Clone() IShape
Clone returns a clone of the ConvexPolygon as an IShape.
func (*ConvexPolygon) ContainedBy ¶
func (cp *ConvexPolygon) ContainedBy(otherShape IShape) bool
ContainedBy returns if the ConvexPolygon is wholly contained by the other shape provided.
func (*ConvexPolygon) FlipH ¶
func (cp *ConvexPolygon) FlipH()
FlipH flips the ConvexPolygon's vertices horizontally according to their initial offset when adding the points.
func (*ConvexPolygon) FlipV ¶
func (cp *ConvexPolygon) FlipV()
FlipV flips the ConvexPolygon's vertices vertically according to their initial offset when adding the points.
func (*ConvexPolygon) Intersection ¶
func (cp *ConvexPolygon) Intersection(dx, dy float64, other IShape) *ContactSet
Intersection tests to see if a ConvexPolygon intersects with the other given Shape. dx and dy are delta movement variables indicating movement to be applied before the intersection check (thereby allowing you to see if a Shape would collide with another if it were in a different relative location). If an Intersection is found, a ContactSet will be returned, giving information regarding the intersection.
func (*ConvexPolygon) Lines ¶
func (cp *ConvexPolygon) Lines() []*collidingLine
Lines returns a slice of transformed internalLines composing the ConvexPolygon.
func (*ConvexPolygon) Move ¶
func (cp *ConvexPolygon) Move(x, y float64)
Move translates the ConvexPolygon by the designated X and Y values.
func (*ConvexPolygon) MoveVec ¶
func (cp *ConvexPolygon) MoveVec(vec vector.Vector)
MoveVec translates the ConvexPolygon by the designated vector.Vector.
func (*ConvexPolygon) PointInside ¶
func (polygon *ConvexPolygon) PointInside(point vector.Vector) bool
PointInside returns if a Point (a vector.Vector) is inside the ConvexPolygon.
func (*ConvexPolygon) Position ¶
func (cp *ConvexPolygon) Position() (float64, float64)
Position returns the position of the ConvexPolygon.
func (*ConvexPolygon) Project ¶
func (cp *ConvexPolygon) Project(axis vector.Vector) Projection
Project projects (i.e. flattens) the ConvexPolygon onto the provided axis.
func (*ConvexPolygon) ReverseVertexOrder ¶
func (cp *ConvexPolygon) ReverseVertexOrder()
ReverseVertexOrder reverses the vertex ordering of the ConvexPolygon.
func (*ConvexPolygon) Rotate ¶ added in v0.6.0
func (polygon *ConvexPolygon) Rotate(radians float64)
Rotate is a helper function to rotate a ConvexPolygon by the radians given.
func (*ConvexPolygon) Rotation ¶ added in v0.6.0
func (polygon *ConvexPolygon) Rotation() float64
Rotation returns the rotation (in radians) of the ConvexPolygon.
func (*ConvexPolygon) SATAxes ¶
func (cp *ConvexPolygon) SATAxes() []vector.Vector
SATAxes returns the axes of the ConvexPolygon for SAT intersection testing.
func (*ConvexPolygon) Scale ¶ added in v0.6.0
func (polygon *ConvexPolygon) Scale() (float64, float64)
Scale returns the scale multipliers of the ConvexPolygon.
func (*ConvexPolygon) SetPosition ¶
func (cp *ConvexPolygon) SetPosition(x, y float64)
SetPosition sets the position of the ConvexPolygon. The offset of the vertices compared to the X and Y position is relative to however you initially defined the polygon and added the vertices.
func (*ConvexPolygon) SetPositionVec ¶
func (cp *ConvexPolygon) SetPositionVec(vec vector.Vector)
SetPositionVec allows you to set the position of the ConvexPolygon using a vector.Vector. The offset of the vertices compared to the X and Y position is relative to however you initially defined the polygon and added the vertices.
func (*ConvexPolygon) SetRotation ¶ added in v0.6.0
func (polygon *ConvexPolygon) SetRotation(radians float64)
SetRotation sets the rotation for the ConvexPolygon; note that the rotation goes counter-clockwise from 0 to pi, and then from -pi at 180 down, back to 0. This can be visualized as follows:
(Pi / 2) | |
(Pi / -Pi) ------------- (0)
| | (-Pi / 2)
This rotation scheme follows the way math.Atan2() works.
func (*ConvexPolygon) SetScale ¶ added in v0.6.0
func (polygon *ConvexPolygon) SetScale(w, h float64)
SetScale sets the scale multipliers of the ConvexPolygon.
func (*ConvexPolygon) Transformed ¶
func (cp *ConvexPolygon) Transformed() []vector.Vector
Transformed returns the ConvexPolygon's points / vertices, transformed according to the ConvexPolygon's position.
type IShape ¶ added in v0.6.0
type IShape interface { // Intersection tests to see if a Shape intersects with the other given Shape. dx and dy are delta movement variables indicating // movement to be applied before the intersection check (thereby allowing you to see if a Shape would collide with another if it // were in a different relative location). If an Intersection is found, a ContactSet will be returned, giving information regarding // the intersection. Intersection(dx, dy float64, other IShape) *ContactSet // Bounds returns the top-left and bottom-right points of the Shape. Bounds() (vector.Vector, vector.Vector) // Position returns the X and Y position of the Shape. Position() (float64, float64) // SetPosition allows you to place a Shape at another location. SetPosition(x, y float64) Rotation() float64 SetRotation(radians float64) // Rotate rotates the IShape by the radians provided. // Note that the rotation goes counter-clockwise from 0 at right to pi/2 in the upwards direction, // pi / -pi at left, -pi/2 in the downwards direction, and finally back to 0. // This can be visualized as follows: // // U // L R // D // // R: 0 // U: pi/2 // L: pi / -pi // D: -pi/2 // // This rotation scheme follows the way math.Atan2() works. // Note that Rotate(), of course, doesn't do anything for circles for obvious reasons. Rotate(radians float64) Scale() (float64, float64) // Returns the scale of the IShape (the radius for Circles). SetScale(w, h float64) // Sets the overall scale of the IShape; 1.0 is 100% scale, 2.0 is 200%, and so on. The greater of these values is used for the radius for Circles. // Move moves the IShape by the x and y values provided. Move(x, y float64) // MoveVec moves the IShape by the movement values given in the vector provided. MoveVec(vec vector.Vector) // Clone duplicates the IShape. Clone() IShape }
type Object ¶
type Object struct { Shape IShape // A shape for more specific collision-checking. Space *Space // Reference to the Space the Object exists within X, Y, W, H float64 // Position and size of the Object in the Space TouchingCells []*Cell // An array of Cells the Object is touching Data interface{} // A pointer to a user-definable object // contains filtered or unexported fields }
Object represents an object that can be spread across one or more Cells in a Space. An Object is essentially an AABB (Axis-Aligned Bounding Box) Rectangle.
func (*Object) AddToIgnoreList ¶
AddToIgnoreList adds the specified Object to the Object's internal collision ignoral list. Cells that contain the specified Object will not be counted when calling Check().
func (*Object) Bottom ¶
Bottom returns the bottom Y coordinate of the Object (i.e. object.Y + object.H).
func (*Object) BoundsToSpace ¶
BoundsToSpace returns the Space coordinates of the shape (x, y, w, and h), given its world position and size, and a supposed movement of dx and dy.
func (*Object) CellPosition ¶
CellPosition returns the cellular position of the Object's center in the Space.
func (*Object) Check ¶
Check checks the space around the object using the designated delta movement (dx and dy). This is done by querying the containing Space's Cells so that it can see if moving it would coincide with a cell that houses another Object (filtered using the given selection of tag strings). If so, Check returns a Collision. If no objects are found or the Object does not exist within a Space, this function returns nil.
func (*Object) Clone ¶
Clone clones the Object with its properties into another Object. It also clones the Object's Shape (if it has one).
func (*Object) RemoveFromIgnoreList ¶
RemoveFromIgnoreList removes the specified Object from the Object's internal collision ignoral list. Objects removed from this list will once again be counted for Check().
func (*Object) RemoveTags ¶
RemoveTags removes tags from the Object.
func (*Object) Right ¶
Right returns the right X coordinate of the Object (i.e. object.X + object.W).
func (*Object) SetBottom ¶
SetBottom sets the Y position of the Object so that the bottom edge is at the Y position given.
func (*Object) SetCenter ¶
SetCenter sets the Object such that its center is at the X and Y position given.
func (*Object) SetRight ¶
SetRight sets the X position of the Object so the right edge is at the X position given.
func (*Object) SetShape ¶ added in v0.5.1
SetShape sets the Shape on the Object, in case you need to use precise per-Shape intersection detection. SetShape calls Object.Update() as well, so that it's able to update the Shape's position to match its Object as necessary. (If you don't use this, the Shape's position might not match the Object's, depending on if you set the Shape after you added the Object to a Space and if you don't call Object.Update() yourself afterwards.)
func (*Object) SharesCells ¶
SharesCells returns whether the Object occupies a cell shared by the specified other Object.
func (*Object) SharesCellsTags ¶
SharesCellsTags returns if the Cells the Object occupies have an object with the specified tags.
type Projection ¶
type Projection struct {
Min, Max float64
}
}
func (Projection) IsInside ¶
func (projection Projection) IsInside(other Projection) bool
IsInside returns whether the Projection is wholly inside of the other, provided Projection.
func (Projection) Overlap ¶
func (projection Projection) Overlap(other Projection) float64
Overlap returns the amount that a Projection is overlapping with the other, provided Projection. Credit to https://dyn4j.org/2010/01/sat/#sat-nointer
func (Projection) Overlapping ¶
func (projection Projection) Overlapping(other Projection) bool
Overlapping returns whether a Projection is overlapping with the other, provided Projection. Credit to https://www.sevenson.com.au/programming/sat/
type Space ¶
type Space struct { Cells [][]*Cell CellWidth, CellHeight int // Width and Height of each Cell in "world-space" / pixels / whatever }
Space represents a collision space. Internally, each Space contains a 2D array of Cells, with each Cell being the same size. Cells contain information on which Objects occupy those spaces.
func NewSpace ¶
NewSpace creates a new Space. spaceWidth and spaceHeight is the width and height of the Space (usually in pixels), which is then populated with cells of size cellWidth by cellHeight. Generally, you want cells to be the size of the smallest collide-able objects in your game, and you want to move Objects at a maximum speed of one cell size per collision check to avoid missing any possible collisions.
func (*Space) Add ¶
Add adds the specified Objects to the Space, updating the Space's cells to refer to the Object.
func (*Space) Cell ¶
Cell returns the Cell at the given cellular / spatial (not world) X and Y position in the Space. If the X and Y position are out of bounds, Cell() will return nil.
func (*Space) CellsInLine ¶
func (*Space) CheckCells ¶
CheckCells checks a set of cells (from x,y to x + w, y + h in cellular coordinates) and return the first object within those Cells that contains any of the tags given. If no tags are given, then CheckCells will return the first Object found in any Cell.
func (*Space) CheckCellsWorld ¶ added in v0.6.0
CheckCellsWorld checks the cells of the Grid with the given world coordinates. Internally, this is just syntactic sugar for calling Space.WorldToSpace() on the position and size given.
func (*Space) Height ¶
Height returns the height of the Space grid in Cells (so a 320x240 Space with 16x16 cells would have a height of 15).
func (*Space) Objects ¶
Objects loops through all Cells in the Space (from top to bottom, and from left to right) to return all Objects that exist in the Space. Of course, each Object is counted only once.
func (*Space) Remove ¶
Remove removes the specified Objects from being associated with the Space. This should be done whenever an Object is removed from the game.
func (*Space) SpaceToWorld ¶
SpaceToWorld converts from a position in the Space (on a grid) to a world-based position, given the size of the Space when first created.
func (*Space) UnregisterAllObjects ¶
func (sp *Space) UnregisterAllObjects()
UnregisterAllObjects unregisters all Objects registered to Cells in the Space.