Documentation
¶
Index ¶
- Variables
- func UpdateSkinAndAAB(shape *Shape, scale vector.TwoReader, rot float64)
- func UpdateWorldVertices(localVerts []vector.Two, pos, scale vector.TwoReader, rot float64) []vector.Two
- func UpdateWorldVerticesSimple(localVerts []vector.Two, pos vector.Two) []vector.Two
- type AAB
- type Circle
- type Collision
- type CollisionEdge
- type Direction
- type Polygon
- type Position
- type PreviousPosition
- type Rotation
- type Scale
- type Shape
- func NewDoubleRamp(width, height float64, topWidthRatio float64) Shape
- func NewPolygon(localVertices []vector.Two) Shape
- func NewRectangle(width, height float64) Shape
- func NewRegularPolygon(radius float64, numVertices int) Shape
- func NewSingleRamp(width, height float64, leftToRight bool) Shape
- func NewTrapezoidPlatform(width, height float64, slopeRatio float64) Shape
- func NewTriangularPlatform(width, height float64) Shape
- type Skin
Constants ¶
This section is empty.
Variables ¶
var Components = components{ Position: warehouse.FactoryNewComponent[Position](), Rotation: warehouse.FactoryNewComponent[Rotation](), Scale: warehouse.FactoryNewComponent[Scale](), Shape: warehouse.FactoryNewComponent[Shape](), Direction: warehouse.FactoryNewComponent[Direction](), }
var ContinuousCollisionDetector continuousDetector
ContinuousCollisionDetector is the global continuous collision detector instance
var Detector detector
Detector is the global collision detector instance
var Resolver resolver
Resolver is the global collision resolver instance (without physics)
Functions ¶
func UpdateSkinAndAAB ¶
UpdateSkinAndAAB updates a shape's skin and axis-aligned bounding box based on scale and rotation Uses optimized path for non-rotated shapes
Types ¶
type Collision ¶
type Collision struct {
Start, End, Normal vector.Two
Depth float64
CollidingEdgeA CollisionEdge
CollidingEdgeB CollisionEdge
}
Collision represents information about a collision between two objects
type CollisionEdge ¶
CollisionEdge represents an edge involved in a collision
type Direction ¶
type Direction struct {
Value directionValue
}
func NewDirectionLeft ¶
func NewDirectionLeft() Direction
func NewDirectionRight ¶
func NewDirectionRight() Direction
type Position ¶
Position represents a 2D point in space
func NewPosition ¶
NewPosition creates a new Position at the specified coordinates
type PreviousPosition ¶
PreviousPosition stores the previous position for continuous collision detection
type Rotation ¶
type Rotation float64
Rotation represents an angle in radians
type Shape ¶
Shape represents a geometric shape with local and world bounds, polygon definition, and skin
func NewDoubleRamp ¶
NewDoubleRamp creates a two-sided ramp (trapezoid with slopes on both sides) width: total width of the ramp height: height of the ramp topWidthRatio: width of the flat section on top (as a ratio of total width, 0-1) Note: In this engine, lower Y values are higher in the world (y=0 is top of screen)
func NewPolygon ¶
NewPolygon creates a new shape from a set of local vertices
func NewRectangle ¶
NewRectangle creates a rectangular shape with specified width and height
func NewRegularPolygon ¶
func NewSingleRamp ¶
NewSingleRamp creates a triangular ramp shape with specified dimensions When leftToRight is true, the ramp ascends from left to right
func NewTrapezoidPlatform ¶
NewTrapezoidPlatform creates a trapezoid shape with a flat top of the specified width, angled sides, and a narrower bottom. The slopeRatio controls how much narrower the bottom is This is useful for creating one-way platforms with more gradual angled sides
func NewTriangularPlatform ¶
NewTriangularPlatform creates a triangular shape with a flat top of the specified width and angled sides meeting at a point at the specified height below the top This is useful for one-way platforms where you want to prevent side collisions