Documentation
¶
Index ¶
- Variables
- func StepSystem2D(name string) ecs.SystemConfig
- func StepSystem3D(name string) ecs.SystemConfig
- func TaskCount2D(world *ecs.World) int
- func TaskCount3D(world *ecs.World) int
- func ValidateBodyTransform(matrix mgl32.Mat4, planar bool) error
- type Body
- func (body Body) AngularVelocity() float64
- func (body Body) ApplyForce(force Vector)
- func (body Body) ApplyImpulse(impulse, worldPoint Vector)
- func (body Body) ApplyTorque(torque float64)
- func (body Body) ClearForces()
- func (body Body) ID() BodyID
- func (body Body) IsSleeping() bool
- func (body Body) Position() Vector
- func (body Body) Rotation() float64
- func (body Body) SetAngularVelocity(value float64)
- func (body Body) SetGravityScale(value float64)
- func (body Body) SetPosition(value Vector)
- func (body Body) SetRotation(value float64)
- func (body Body) SetType(value BodyType)
- func (body Body) SetVelocity(value Vector)
- func (body Body) Type() BodyType
- func (body Body) UserData() uint64
- func (body Body) Valid() bool
- func (body Body) Velocity() Vector
- func (body Body) Wake()
- type Body3D
- func (body Body3D) AngularVelocity() Vector3D
- func (body Body3D) ApplyForce(force Vector3D)
- func (body Body3D) ApplyImpulse(impulse, worldPoint Vector3D)
- func (body Body3D) ApplyTorque(torque Vector3D)
- func (body Body3D) ClearForces()
- func (body Body3D) ID() BodyID3D
- func (body Body3D) Position() Vector3D
- func (body Body3D) Rotation() Quaternion
- func (body Body3D) SetAngularVelocity(value Vector3D)
- func (body Body3D) SetGravityScale(value float64)
- func (body Body3D) SetPosition(value Vector3D)
- func (body Body3D) SetRotation(value Quaternion)
- func (body Body3D) SetType(value BodyType)
- func (body Body3D) SetVelocity(value Vector3D)
- func (body Body3D) Type() BodyType
- func (body Body3D) UserData() uint64
- func (body Body3D) Valid() bool
- func (body Body3D) Velocity() Vector3D
- type BodyDef
- type BodyDef3D
- type BodyID
- type BodyID3D
- type BodyType
- type Bounds3D
- type Box
- type Box3D
- type BoxCollider2D
- type BoxCollider3D
- type Capsule
- type CapsuleCollider3D
- type Circle
- type CircleCollider2D
- type Collider2D
- type Collider3D
- type ColliderDef
- type ColliderHandle
- func (collider ColliderHandle[S]) CollisionType() uint32
- func (collider ColliderHandle[S]) Filter() Filter
- func (collider ColliderHandle[S]) ID() ColliderID
- func (collider ColliderHandle[S]) Sensor() bool
- func (collider ColliderHandle[S]) SetCollisionType(value uint32)
- func (collider ColliderHandle[S]) SetFilter(value Filter)
- func (collider ColliderHandle[S]) SetMaterial(friction, restitution float64)
- func (collider ColliderHandle[S]) SetSensor(value bool)
- func (collider ColliderHandle[S]) SetShape(shape S)
- func (collider ColliderHandle[S]) Shape() S
- func (collider ColliderHandle[S]) Valid() bool
- type ColliderHandle3D
- func (collider ColliderHandle3D[S]) CollisionType() uint32
- func (collider ColliderHandle3D[S]) Filter() Filter
- func (collider ColliderHandle3D[S]) ID() ColliderID3D
- func (collider ColliderHandle3D[S]) Sensor() bool
- func (collider ColliderHandle3D[S]) SetCollisionType(value uint32)
- func (collider ColliderHandle3D[S]) SetFilter(value Filter)
- func (collider ColliderHandle3D[S]) SetMaterial(friction, restitution float64)
- func (collider ColliderHandle3D[S]) SetSensor(value bool)
- func (collider ColliderHandle3D[S]) SetShape(shape S)
- func (collider ColliderHandle3D[S]) Shape() S
- func (collider ColliderHandle3D[S]) Valid() bool
- type ColliderID
- type ColliderID3D
- type CollisionEvent
- type CollisionEvent3D
- type CollisionMessage2D
- type CollisionMessage3D
- type CollisionMode
- type CollisionPhase
- type Compound
- type CompoundChild
- type CompoundCollider3D
- type ConvexFace
- type ConvexHull
- type ConvexHullCollider3D
- type CookedCollision
- type Filter
- type MeshRayHit
- type Quaternion
- type RigidBody2D
- type RigidBody3D
- type Runtime2D
- type Runtime3D
- type Segment
- type SegmentCollider2D
- type Shape
- type Shape2D
- type Shape3D
- type SleepConfig
- type Sphere
- type SphereCollider3D
- type StepStatistics
- type TriangleMesh
- type TriangleMeshCollider3D
- type TriangleMeshNode
- type Vector
- func (v Vector) Add(other Vector) Vector
- func (v Vector) Dot(other Vector) float64
- func (v Vector) Length() float64
- func (v Vector) LengthSquared() float64
- func (v Vector) Mul(scalar float64) Vector
- func (v Vector) Normalize() Vector
- func (v Vector) Perpendicular() Vector
- func (v Vector) Sub(other Vector) Vector
- type Vector3D
- func (v Vector3D) Add(other Vector3D) Vector3D
- func (v Vector3D) Cross(other Vector3D) Vector3D
- func (v Vector3D) Dot(other Vector3D) float64
- func (v Vector3D) Length() float64
- func (v Vector3D) LengthSquared() float64
- func (v Vector3D) Mul(scalar float64) Vector3D
- func (v Vector3D) Normalize() Vector3D
- func (v Vector3D) Sub(other Vector3D) Vector3D
- type World
- func (world *World) AddCollider[S Shape2D](body Body, def ColliderDef[S]) ColliderHandle[S]
- func (world *World) Body(id BodyID) Body
- func (world *World) CreateBody(def BodyDef) Body
- func (world *World) Events() []CollisionEvent
- func (world *World) RemoveBody(body Body) bool
- func (world *World) RemoveCollider[S Shape2D](collider ColliderHandle[S]) bool
- func (world *World) Reserve(bodyCount, colliderCount int)
- func (world *World) Statistics() StepStatistics
- func (world *World) Step(delta float64)
- type World3D
- func (world *World3D) AddCollider[S Shape3D](body Body3D, def ColliderDef[S]) ColliderHandle3D[S]
- func (world *World3D) Body3D(id BodyID3D) Body3D
- func (world *World3D) CreateBody(def BodyDef3D) Body3D
- func (world *World3D) Events() []CollisionEvent3D
- func (world *World3D) RemoveBody(body Body3D) bool
- func (world *World3D) RemoveCollider[S Shape3D](collider ColliderHandle3D[S]) bool
- func (world *World3D) Reserve(bodyCount, colliderCount int)
- func (world *World3D) Step(delta float64)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func StepSystem2D ¶
func StepSystem2D(name string) ecs.SystemConfig
func StepSystem3D ¶
func StepSystem3D(name string) ecs.SystemConfig
func TaskCount2D ¶
TaskCount2D includes active ECS simulation bodies, manually created bodies, and pending synchronization. Idle requires all external inputs to be consumed.
func TaskCount3D ¶
TaskCount3D includes non-static bodies and pending synchronization, including removal or deactivation of the last managed body.
func ValidateBodyTransform ¶
ValidateBodyTransform rejects transforms the rigid-body solvers cannot represent. Shape dimensions are authored in world units; scaling, reflection and shear must be baked into the collision resource instead.
Types ¶
type Body ¶
type Body struct {
// contains filtered or unexported fields
}
func (Body) AngularVelocity ¶
func (Body) ApplyForce ¶
func (Body) ApplyImpulse ¶
func (Body) ApplyTorque ¶
func (Body) ClearForces ¶
func (body Body) ClearForces()
func (Body) IsSleeping ¶
IsSleeping reports whether the optional contact-island sleep policy suspended this body.
func (Body) SetAngularVelocity ¶
func (Body) SetGravityScale ¶
func (Body) SetPosition ¶
func (Body) SetRotation ¶
func (Body) SetVelocity ¶
type Body3D ¶
type Body3D struct {
// contains filtered or unexported fields
}
func (Body3D) AngularVelocity ¶
func (Body3D) ApplyForce ¶
func (Body3D) ApplyImpulse ¶
func (Body3D) ApplyTorque ¶
func (Body3D) ClearForces ¶
func (body Body3D) ClearForces()
func (Body3D) Rotation ¶
func (body Body3D) Rotation() Quaternion
func (Body3D) SetAngularVelocity ¶
func (Body3D) SetGravityScale ¶
func (Body3D) SetPosition ¶
func (Body3D) SetRotation ¶
func (body Body3D) SetRotation(value Quaternion)
func (Body3D) SetVelocity ¶
type BodyDef ¶
type BodyDef struct {
Velocity Vector
Position Vector
Inertia float64
Rotation float64
AngularVelocity float64
Mass float64
GravityScale float64
LinearDamping float64
AngularDamping float64
UserData uint64
Type BodyType
FixedRotation bool
// contains filtered or unexported fields
}
func NewBodyDef ¶
type BodyDef3D ¶
type BodyDef3D struct {
Rotation Quaternion
AngularVelocity Vector3D
Position Vector3D
Velocity Vector3D
Inertia float64
Mass float64
GravityScale float64
LinearDamping float64
AngularDamping float64
UserData uint64
Type BodyType
FixedRotation bool
// contains filtered or unexported fields
}
func NewBodyDef3D ¶
type Bounds3D ¶
Bounds3D is an axis-aligned box used by cooked collision resources. Bounds are expressed in the resource's local space.
type Box3D ¶
type Box3D struct {
Center Vector3D
HalfExtents Vector3D
Rotation Quaternion
}
type BoxCollider2D ¶
type BoxCollider2D = Collider2D[Box]
type BoxCollider3D ¶
type BoxCollider3D = Collider3D[Box3D]
type Capsule ¶
type Capsule struct {
Center Vector3D
Rotation Quaternion
HalfHeight float64
Radius float64
}
Capsule is aligned to its local Y axis. HalfHeight excludes the round caps.
func NewCapsule ¶
type CapsuleCollider3D ¶
type CapsuleCollider3D = Collider3D[Capsule]
type CircleCollider2D ¶
type CircleCollider2D = Collider2D[Circle]
type Collider2D ¶
type Collider2D[S Shape2D] struct { Shape S Filter Filter Friction float64 Restitution float64 CollisionType uint32 Sensor bool // contains filtered or unexported fields }
func NewCollider2D ¶
func NewCollider2D[S Shape2D](shape S) Collider2D[S]
func (*Collider2D[S]) Handle ¶
func (collider *Collider2D[S]) Handle() ColliderHandle[S]
type Collider3D ¶
type Collider3D[S Shape3D] struct { Shape S Filter Filter Friction float64 Restitution float64 CollisionType uint32 Sensor bool // contains filtered or unexported fields }
func NewCollider3D ¶
func NewCollider3D[S Shape3D](shape S) Collider3D[S]
func (*Collider3D[S]) Handle ¶
func (collider *Collider3D[S]) Handle() ColliderHandle3D[S]
type ColliderDef ¶
type ColliderDef[S Shape] struct { Shape S Filter Filter Friction float64 Restitution float64 CollisionType uint32 Sensor bool }
func NewColliderDef ¶
func NewColliderDef[S Shape](shape S) ColliderDef[S]
type ColliderHandle ¶
type ColliderHandle[S Shape2D] struct { // contains filtered or unexported fields }
func (ColliderHandle[S]) CollisionType ¶
func (collider ColliderHandle[S]) CollisionType() uint32
func (ColliderHandle[S]) Filter ¶
func (collider ColliderHandle[S]) Filter() Filter
func (ColliderHandle[S]) ID ¶
func (collider ColliderHandle[S]) ID() ColliderID
func (ColliderHandle[S]) Sensor ¶
func (collider ColliderHandle[S]) Sensor() bool
func (ColliderHandle[S]) SetCollisionType ¶
func (collider ColliderHandle[S]) SetCollisionType(value uint32)
func (ColliderHandle[S]) SetFilter ¶
func (collider ColliderHandle[S]) SetFilter(value Filter)
func (ColliderHandle[S]) SetMaterial ¶
func (collider ColliderHandle[S]) SetMaterial(friction, restitution float64)
func (ColliderHandle[S]) SetSensor ¶
func (collider ColliderHandle[S]) SetSensor(value bool)
func (ColliderHandle[S]) SetShape ¶
func (collider ColliderHandle[S]) SetShape(shape S)
func (ColliderHandle[S]) Shape ¶
func (collider ColliderHandle[S]) Shape() S
func (ColliderHandle[S]) Valid ¶
func (collider ColliderHandle[S]) Valid() bool
type ColliderHandle3D ¶
type ColliderHandle3D[S Shape3D] struct { // contains filtered or unexported fields }
func (ColliderHandle3D[S]) CollisionType ¶
func (collider ColliderHandle3D[S]) CollisionType() uint32
func (ColliderHandle3D[S]) Filter ¶
func (collider ColliderHandle3D[S]) Filter() Filter
func (ColliderHandle3D[S]) ID ¶
func (collider ColliderHandle3D[S]) ID() ColliderID3D
func (ColliderHandle3D[S]) Sensor ¶
func (collider ColliderHandle3D[S]) Sensor() bool
func (ColliderHandle3D[S]) SetCollisionType ¶
func (collider ColliderHandle3D[S]) SetCollisionType(value uint32)
func (ColliderHandle3D[S]) SetFilter ¶
func (collider ColliderHandle3D[S]) SetFilter(value Filter)
func (ColliderHandle3D[S]) SetMaterial ¶
func (collider ColliderHandle3D[S]) SetMaterial(friction, restitution float64)
func (ColliderHandle3D[S]) SetSensor ¶
func (collider ColliderHandle3D[S]) SetSensor(value bool)
func (ColliderHandle3D[S]) SetShape ¶
func (collider ColliderHandle3D[S]) SetShape(shape S)
func (ColliderHandle3D[S]) Shape ¶
func (collider ColliderHandle3D[S]) Shape() S
func (ColliderHandle3D[S]) Valid ¶
func (collider ColliderHandle3D[S]) Valid() bool
type ColliderID ¶
type ColliderID uint64
type ColliderID3D ¶
type ColliderID3D uint64
type CollisionEvent ¶
type CollisionEvent struct {
Phase CollisionPhase
BodyA BodyID
BodyB BodyID
ColliderA ColliderID
ColliderB ColliderID
CollisionTypeA uint32
CollisionTypeB uint32
UserDataA uint64
UserDataB uint64
Normal Vector
Point Vector
Penetration float64
}
type CollisionEvent3D ¶
type CollisionEvent3D struct {
Phase CollisionPhase
BodyA BodyID3D
BodyB BodyID3D
ColliderA ColliderID3D
ColliderB ColliderID3D
CollisionTypeA uint32
CollisionTypeB uint32
UserDataA uint64
UserDataB uint64
Normal Vector3D
Point Vector3D
Penetration float64
}
type CollisionMessage2D ¶
type CollisionMessage2D struct {
Phase CollisionPhase
Entity ecs.Entity
Other ecs.Entity
Collider ColliderID
OtherCollider ColliderID
CollisionType uint32
OtherType uint32
Normal Vector
Point Vector
Penetration float64
}
type CollisionMessage3D ¶
type CollisionMessage3D struct {
Phase CollisionPhase
Entity ecs.Entity
Other ecs.Entity
Collider ColliderID3D
OtherCollider ColliderID3D
CollisionType uint32
OtherType uint32
Normal Vector3D
Point Vector3D
Penetration float64
}
type CollisionMode ¶
type CollisionMode string
CollisionMode selects the shape produced by model import baking.
const ( CollisionModeTriangleMesh CollisionMode = "trimesh" CollisionModeSingleConvex CollisionMode = "singleConvex" CollisionModeConvexDecomposition CollisionMode = "convexDecomposition" )
func ParseCollisionMode ¶
func ParseCollisionMode(value string) (CollisionMode, error)
func (CollisionMode) String ¶
func (mode CollisionMode) String() string
type CollisionPhase ¶
type CollisionPhase uint8
const ( CollisionBegin CollisionPhase = iota CollisionStay CollisionEnd )
type Compound ¶
type Compound struct {
Children []CompoundChild
Bounds Bounds3D
}
Compound is an immutable collection of convex hulls for dynamic concave models. Children are never decomposed or allocated during simulation.
func ConvexDecomposition ¶
func ConvexDecomposition(pieces []ConvexHull) (Compound, error)
ConvexDecomposition creates the runtime compound from importer-produced convex pieces. CoACD/V-HACD integration belongs to the asset pipeline; this API keeps the runtime format independent of whichever offline tool produced the pieces.
func NewCompound ¶
func NewCompound(children []CompoundChild) (Compound, error)
func NewCompoundFromHulls ¶
func NewCompoundFromHulls(pieces []ConvexHull) (Compound, error)
func (Compound) ChildCount ¶
type CompoundChild ¶
type CompoundChild struct {
Shape ConvexHull
Position Vector3D
Rotation Quaternion
}
CompoundChild is a locally transformed, already-cooked convex hull.
type CompoundCollider3D ¶
type CompoundCollider3D = Collider3D[Compound]
type ConvexFace ¶
ConvexFace is one outward-oriented triangle of a cooked convex hull.
type ConvexHull ¶
type ConvexHull struct {
Vertices []Vector3D
Faces []ConvexFace
Edges [][2]uint32
Bounds Bounds3D
}
ConvexHull is an immutable convex collision resource. It contains the original support vertices and the baked surface faces used for contacts.
func NewConvexHull ¶
func NewConvexHull(vertices []Vector3D) (ConvexHull, error)
NewConvexHull builds a convex hull during asset baking with an incremental QuickHull pass. The expensive visibility and horizon work stays out of the simulation and scales quadratically for typical imported meshes.
func QuickHull ¶
func QuickHull(vertices []Vector3D) (ConvexHull, error)
QuickHull is the importer-facing name for convex hull cooking.
func (ConvexHull) Cooked ¶
func (hull ConvexHull) Cooked() bool
func (ConvexHull) FaceCount ¶
func (hull ConvexHull) FaceCount() int
func (ConvexHull) VertexCount ¶
func (hull ConvexHull) VertexCount() int
type ConvexHullCollider3D ¶
type ConvexHullCollider3D = Collider3D[ConvexHull]
type CookedCollision ¶
type CookedCollision struct {
Mode CollisionMode
TriangleMesh TriangleMesh
ConvexHull ConvexHull
Compound Compound
}
CookedCollision keeps all mode-specific outputs in one immutable resource. Only the selected field is populated by CookCollision.
func CookCollision ¶
func CookCollision(vertices []Vector3D, indices []uint32, mode CollisionMode) (CookedCollision, error)
CookCollision performs the importer-side cooking step. Convex decomposition accepts a single convex fallback here; asset importers that use CoACD should pass all generated pieces to ConvexDecomposition and store the resulting Compound directly.
type MeshRayHit ¶
MeshRayHit is a hit in the triangle mesh's local coordinate system.
type Quaternion ¶
Quaternion stores an orientation as an (x, y, z, w) unit quaternion.
func Q ¶
func Q(x, y, z, w float64) Quaternion
func QuaternionFromAxisAngle ¶
func QuaternionFromAxisAngle(axis Vector3D, angle float64) Quaternion
func QuaternionIdentity ¶
func QuaternionIdentity() Quaternion
func (Quaternion) Conjugate ¶
func (q Quaternion) Conjugate() Quaternion
func (Quaternion) Mul ¶
func (q Quaternion) Mul(other Quaternion) Quaternion
func (Quaternion) Normalize ¶
func (q Quaternion) Normalize() Quaternion
func (Quaternion) Rotate ¶
func (q Quaternion) Rotate(vector Vector3D) Vector3D
type RigidBody2D ¶
type RigidBody2D struct {
Force Vector
Velocity Vector
Impulse Vector
AngularDamping float64
AngularVelocity float64
Inertia float64
LinearDamping float64
Torque float64
Mass float64
GravityScale float64
Type BodyType
FixedRotation bool
// contains filtered or unexported fields
}
RigidBody2D turns a world-space scene node into a simulated body. Dynamic bodies write their pose back to Transform; static and kinematic bodies read their pose from Transform before each fixed step.
func NewRigidBody2D ¶
func NewRigidBody2D(bodyType BodyType) RigidBody2D
func (*RigidBody2D) ApplyForce ¶
func (body *RigidBody2D) ApplyForce(force Vector)
func (*RigidBody2D) ApplyImpulse ¶
func (body *RigidBody2D) ApplyImpulse(impulse Vector)
func (*RigidBody2D) ApplyTorque ¶
func (body *RigidBody2D) ApplyTorque(torque float64)
func (*RigidBody2D) Handle ¶
func (body *RigidBody2D) Handle() Body
type RigidBody3D ¶
type RigidBody3D struct {
Force Vector3D
Torque Vector3D
Impulse Vector3D
Velocity Vector3D
AngularVelocity Vector3D
GravityScale float64
AngularDamping float64
Inertia float64
LinearDamping float64
Mass float64
Type BodyType
FixedRotation bool
// contains filtered or unexported fields
}
RigidBody3D binds a world-space transform to a simulated body.
func NewRigidBody3D ¶
func NewRigidBody3D(bodyType BodyType) RigidBody3D
func (*RigidBody3D) ApplyForce ¶
func (body *RigidBody3D) ApplyForce(force Vector3D)
func (*RigidBody3D) ApplyImpulse ¶
func (body *RigidBody3D) ApplyImpulse(impulse Vector3D)
func (*RigidBody3D) ApplyTorque ¶
func (body *RigidBody3D) ApplyTorque(torque Vector3D)
func (*RigidBody3D) Handle ¶
func (body *RigidBody3D) Handle() Body3D
type Runtime2D ¶
type Runtime2D struct {
Simulation *World
// contains filtered or unexported fields
}
func NewRuntime2D ¶
func NewRuntime2D() *Runtime2D
type Runtime3D ¶
type Runtime3D struct {
Simulation *World3D
// contains filtered or unexported fields
}
func NewRuntime3D ¶
func NewRuntime3D() *Runtime3D
type SegmentCollider2D ¶
type SegmentCollider2D = Collider2D[Segment]
type Shape ¶
type Shape interface {
// contains filtered or unexported methods
}
Shape is closed to this package so every generic collider can be lowered to an allocation-free internal representation.
type Shape2D ¶
type Shape2D interface {
Shape
// contains filtered or unexported methods
}
Shape2D accepts shapes supported by the 2D solver.
type Shape3D ¶
type Shape3D interface {
Shape
// contains filtered or unexported methods
}
Shape3D is closed so generic colliders lower to an allocation-free internal value.
type SleepConfig ¶
SleepConfig enables whole contact-island sleeping. The zero value disables sleeping; nonpositive thresholds use the defaults below (world units/second, radians/second, and seconds respectively).
type SphereCollider3D ¶
type SphereCollider3D = Collider3D[Sphere]
type StepStatistics ¶
type StepStatistics struct {
BoundsUpdates, IndexUpdates, PairQueries, ContactBuilds int
SleepingBodies int
}
StepStatistics reports work performed by the last Step, without allocating.
type TriangleMesh ¶
type TriangleMesh struct {
Vertices []Vector3D
Indices []uint32
TriangleIndices []uint32
BVH []TriangleMeshNode
Bounds Bounds3D
}
TriangleMesh is an immutable, cooked static collision resource. The slices are owned by the value returned from NewTriangleMesh and must not be edited after construction.
func CookTriangleMesh ¶
func CookTriangleMesh(vertices []Vector3D, indices []uint32) (TriangleMesh, error)
CookTriangleMesh is an explicit name for callers that keep authored mesh data separate from its immutable runtime representation.
func NewTriangleMesh ¶
func NewTriangleMesh(vertices []Vector3D, indices []uint32) (TriangleMesh, error)
NewTriangleMesh validates and cooks a triangle mesh once. Invalid index references are rejected; repeated vertices and zero-area triangles are removed from the cooked copy.
func (TriangleMesh) Cooked ¶
func (mesh TriangleMesh) Cooked() bool
func (TriangleMesh) OverlapsCapsule ¶
func (mesh TriangleMesh) OverlapsCapsule(start, end Vector3D, radius float64) bool
OverlapsCapsule tests a capsule given its segment endpoints and radius in mesh-local space. It tests actual triangles, including edges and vertices.
func (TriangleMesh) Raycast ¶
func (mesh TriangleMesh) Raycast(origin, direction Vector3D, limit float64) (MeshRayHit, bool)
Raycast returns the closest two-sided triangle hit. Direction must be unit length. The cooked BVH and traversal stack are reused without allocation.
func (TriangleMesh) TriangleCount ¶
func (mesh TriangleMesh) TriangleCount() int
type TriangleMeshCollider3D ¶
type TriangleMeshCollider3D = Collider3D[TriangleMesh]
type TriangleMeshNode ¶
TriangleMeshNode is a node in a cooked triangle mesh BVH. A node with Count greater than zero is a leaf and indexes TriangleIndices[First:First+Count].
type Vector ¶
Vector is the scalar-independent two-dimensional value used by the physics runtime. The solver uses float64 so long simulations do not accumulate the visible drift caused by render-space float32 transforms.
func (Vector) LengthSquared ¶
func (Vector) Perpendicular ¶
type Vector3D ¶
Vector3D is the float64 simulation-space vector used by the 3D solver.
func (Vector3D) LengthSquared ¶
type World ¶
type World struct {
Sleep SleepConfig
Gravity Vector
Iterations int
CellSize float64
CollisionSlop float64
Damping float64
// contains filtered or unexported fields
}
func (*World) AddCollider ¶
func (world *World) AddCollider[S Shape2D](body Body, def ColliderDef[S]) ColliderHandle[S]
func (*World) CreateBody ¶
func (*World) Events ¶
func (world *World) Events() []CollisionEvent
func (*World) RemoveBody ¶
func (*World) RemoveCollider ¶
func (world *World) RemoveCollider[S Shape2D](collider ColliderHandle[S]) bool
func (*World) Reserve ¶
Reserve preserves existing bodies and contacts while reserving pools and estimated scratch capacity. Dense contacts or small cells can require more scratch; once warmed up, Step reuses that storage without allocations.
func (*World) Statistics ¶
func (world *World) Statistics() StepStatistics
type World3D ¶
type World3D struct {
Gravity Vector3D
Iterations int
CellSize float64
CollisionSlop float64
Damping float64
// contains filtered or unexported fields
}
func NewWorld3D ¶
func NewWorld3D() *World3D
func (*World3D) AddCollider ¶
func (world *World3D) AddCollider[S Shape3D](body Body3D, def ColliderDef[S]) ColliderHandle3D[S]
func (*World3D) CreateBody ¶
func (*World3D) Events ¶
func (world *World3D) Events() []CollisionEvent3D
func (*World3D) RemoveBody ¶
func (*World3D) RemoveCollider ¶
func (world *World3D) RemoveCollider[S Shape3D](collider ColliderHandle3D[S]) bool