package graviton
Constants
DefaultCollisionGroup
0
DefaultCollisionMask
1 << DefaultCollisionGroup
DefaultSleepThreshold
matrix.[Float(0](../matrix#Float(0)
Variables
NullAABB
AABB{Type: ShapeTypeAABB}
Functions
AngularAxisEffectiveMass
AngularConstraintEffectiveMass
AngularConstraintImpulseDenominator
AngularEffectiveMass
CalculateLocalInertia
ConstraintEffectiveMass
ConstraintImpulseDenominator
LocalAnchor
LocalAxis
PointOutsideOfPlane
PointOutsideOfPlane returns true if the given point is outside of the plane
RelativeAnchorOffset
RemoveAllLeavesMatchingTransform
RemoveBVHNode
RemoveSubBVH
VelocityAtAnchor
WakeConstrainedBodies
WorldAnchor
WorldAxis
Types
AABB
AABBFromCorners
AABBFromCorners creates an AABB from 8 corner points
AABBFromMinMax
AABBFromMinMax creates an AABB from the minimum and maximum points
AABBFromPoints
AABBFromTransform
AABBFromTriangles
AABBFromWidth
AABBFromWidth creates an AABB from the center and half-width
AABBUnion
Union returns the union of two AABBs
NewAABB
AABB.AABBIntersect
AABBIntersect returns whether the AABB intersects another AABB
AABB.Bounds
Satisfying BVH HitObject interface
AABB.ClosestDistance
ClosestDistance returns the closest distance between two AABBs
AABB.Contains
Contains returns whether the AABB contains the point
AABB.ContainsAABB
ContainsAABB returns whether the AABB contains another AABB
AABB.Corners
AABB.FromTriangle
FromTriangle returns an AABB that contains the triangle
AABB.IntersectsFrustum
IntersectsFrustum returns whether the AABB is in the frustum
AABB.LongestAxis
LongestAxis returns the longest axis of the AABB (0 = X, 1 = Y, 2 = Z)
AABB.Max
Max returns the maximum point of the AABB
AABB.Min
Min returns the minimum point of the AABB
AABB.PlaneIntersect
PlaneIntersect returns whether the AABB intersects a plane
AABB.RayHit
RayHit returns the point of intersection and whether the ray hit the AABB
AABB.RayIntersectTest
func (box AABB) RayIntersectTest(ray Ray, length float32, transform *matrix.Transform) (matrix.Vec3, bool)
AABB.Size
Size returns the size of the AABB
AABB.SurfaceArea
AABB.Transform
AABB.TriangleIntersect
TriangleIntersect returns whether the AABB intersects a triangle
ActivePair
struct
ActivePair represents a potential collision pair found by SAP
AngularConstraintSolverRow
struct
type AngularConstraintSolverRow struct {
BodyA *RigidBody
BodyB *RigidBody
Axis matrix.Vec3
EffectiveMass matrix.Float
Bias matrix.Float
AccumulatedImpulse matrix.Float
MinImpulse matrix.Float
MaxImpulse matrix.Float
}
AngularConstraintSolverRow stores a scalar angular-only Jacobian row. It is used by constraints that must remove relative angular velocity around a world-space axis without applying any linear impulse.
AngularConstraintSolverRow.ApplyImpulse
AngularConstraintSolverRow.RelativeVelocity
AngularConstraintSolverRow.SetImpulseLimits
AngularConstraintSolverRow.SetWorldAxis
AngularConstraintSolverRow.Solve
Axis
const ( AxisX Axis = iota AxisY AxisZ )
BVH
struct
AddSubBVH
CloneBVH
InsertBVH
NewBVH
BVH.Bounds
BVH.IsLeaf
BVH.RayIntersect
BVH.RayIntersectTest
func (b *BVH) RayIntersectTest(ray Ray, length float32, transform *matrix.Transform) (matrix.Vec3, bool)
BVH.Refit
BVH.RefitUpwards
BVHItem
struct
BVHItem.Bounds
BVHItem.IsValid
BVHItem.RayIntersect
func (item BVHItem) RayIntersect(ray Ray, length float32, transform *matrix.Transform) (matrix.Vec3, bool)
BroadPhaseFilter
Capsule
NewCapsule
func NewCapsule(center matrix.Vec3, radius matrix.Float, height matrix.Float, direction matrix.Vec3) Capsule
Capsule.IntersectsAABB
Capsule.IntersectsCapsule
Capsule.IntersectsCone
Capsule.IntersectsCylinder
Capsule.IntersectsFrustum
Capsule.IntersectsOOBB
Capsule.IntersectsPlane
Capsule.IntersectsRay
Capsule.IntersectsSphere
Circle
struct
Circle.RayHit
CollisionInfo
struct
type CollisionInfo struct {
Shape Shape
Mesh *MeshCollision
Terrain *TerrainCollision
LocalAABB AABB
Group int
Mask int
IsTrigger bool
}
CollisionSolver
struct
type CollisionSolver struct {
VelocityIterations int
PositionIterations int
DeltaTime matrix.Float
Restitution matrix.Float
StaticFriction matrix.Float
DynamicFriction matrix.Float
Baumgarte matrix.Float
PenetrationSlop matrix.Float
MaxCorrection matrix.Float
// Has unexported fields.
}
CollisionSolver resolves narrow-phase contacts with an iterative impulse solver. Contacts are grouped into independent dynamic islands so islands can be solved in parallel without concurrent writes to the same body.
CollisionSolver.Initialize
CollisionSolver.Reset
CollisionSolver.Solve
CollisionSolver.SolveWithConstraints
func (s *CollisionSolver) SolveWithConstraints(manifolds []ContactManifold, constraints []*Constraint, threads *concurrent.Threads)
Cone
NewCone
func NewCone(center matrix.Vec3, radius matrix.Float, height matrix.Float, direction matrix.Vec3) Cone
Cone.IntersectCone
Cone.IntersectsAABB
Cone.IntersectsCapsule
Cone.IntersectsCylinder
Cone.IntersectsFrustum
Cone.IntersectsOOBB
Cone.IntersectsPlane
Cone.IntersectsRay
Cone.IntersectsSphere
Constraint
struct
type Constraint struct {
Type ConstraintType
BodyA *RigidBody
BodyB *RigidBody
Rows []ConstraintSolverRow
Distance *DistanceJoint
Rope *RopeJoint
Point *PointJoint
Hinge *HingeJoint
Active bool
Enabled bool
// BreakForce and BreakTorque are optional impulse thresholds. Values <= 0
// leave that break mode disabled.
BreakForce matrix.Float
BreakTorque matrix.Float
Broken bool
// Has unexported fields.
}
Constraint stores the lifecycle and endpoints for a future Graviton constraint solver. BodyA and BodyB form a body-body constraint; either body may be nil to represent a body-world constraint.
Constraint.AccumulatedAngularImpulse
Constraint.AccumulatedLinearImpulse
Constraint.BodiesValid
Constraint.BreakIfNeeded
Constraint.IsBodyBody
Constraint.IsBodyWorld
Constraint.IsStretched
Constraint.IsValid
Constraint.SetActive
Constraint.SetBodies
Constraint.SetBreakForce
Constraint.SetBreakTorque
Constraint.SetEnabled
Constraint.WakeBodies
ConstraintSolverRow
struct
type ConstraintSolverRow struct {
BodyA *RigidBody
BodyB *RigidBody
Axis matrix.Vec3
JacobianLinearA matrix.Vec3
JacobianAngularA matrix.Vec3
JacobianLinearB matrix.Vec3
JacobianAngularB matrix.Vec3
AnchorA matrix.Vec3
AnchorB matrix.Vec3
RelativeAnchorA matrix.Vec3
RelativeAnchorB matrix.Vec3
EffectiveMass matrix.Float
Bias matrix.Float
AccumulatedImpulse matrix.Float
MinImpulse matrix.Float
MaxImpulse matrix.Float
}
ConstraintSolverRow stores a single scalar Jacobian row for iterative constraint solving. The row applies impulses along Axis at both anchors, where BodyA receives the negative impulse and BodyB receives the positive impulse.
NewConstraintSolverRow
func NewConstraintSolverRow(bodyA, bodyB *RigidBody, anchorA, anchorB, axis matrix.Vec3) ConstraintSolverRow
ConstraintSolverRow.ApplyImpulse
ConstraintSolverRow.RelativeVelocity
ConstraintSolverRow.SetImpulseLimits
ConstraintSolverRow.SetLocalAnchors
func (r *ConstraintSolverRow) SetLocalAnchors(bodyA, bodyB *RigidBody, anchorA, anchorB, axis matrix.Vec3)
ConstraintSolverRow.SetWorldAnchors
func (r *ConstraintSolverRow) SetWorldAnchors(bodyA, bodyB *RigidBody, anchorA, anchorB, axis matrix.Vec3)
ConstraintSolverRow.Solve
ConstraintType
const ( ConstraintTypeUnknown ConstraintType = iota ConstraintTypeGeneric ConstraintTypeDistance ConstraintTypeRope ConstraintTypePoint ConstraintTypeHinge )
Contact
struct
type Contact struct {
BodyA *RigidBody
BodyB *RigidBody
Point matrix.Vec3
PointA matrix.Vec3
PointB matrix.Vec3
Normal matrix.Vec3
Penetration matrix.Float
}
Contact contains one world-space contact point generated by the narrow phase. Normal always points from BodyA toward BodyB.
ContactManifold
struct
type ContactManifold struct {
BodyA *RigidBody
BodyB *RigidBody
Normal matrix.Vec3
Contacts [maxManifoldContacts]Contact
Count int
}
ContactManifold groups contacts for a colliding body pair.
CollideBodies
Cylinder
NewCylinder
func NewCylinder(center matrix.Vec3, radius matrix.Float, height matrix.Float, direction matrix.Vec3) Cylinder
Cylinder.IntersectsAABB
Cylinder.IntersectsCapsule
Cylinder.IntersectsCone
Cylinder.IntersectsCylinder
Cylinder.IntersectsFrustum
Cylinder.IntersectsOOBB
Cylinder.IntersectsPlane
Cylinder.IntersectsRay
Cylinder.IntersectsSphere
DetailedTriangle
struct
type DetailedTriangle struct {
Points [3]matrix.Vec3
Normal matrix.Vec3
Centroid matrix.Vec3
Radius matrix.Float
}
DetailedTriangleFromPoints
DetailedTriangleFromPoints creates a detailed triangle from three points, a detailed triangle is different from a regular triangle in that it contains additional information such as the centroid and radius
DetailedTriangle.Bounds
DetailedTriangle.RayIntersectTest
func (t DetailedTriangle) RayIntersectTest(ray Ray, length float32, transform *matrix.Transform) (matrix.Vec3, bool)
DistanceJoint
struct
type DistanceJoint struct {
BodyA *RigidBody
BodyB *RigidBody
LocalAnchorA matrix.Vec3
LocalAnchorB matrix.Vec3
RestLength matrix.Float
Stiffness matrix.Float
BiasFactor matrix.Float
PositionCorrectionFactor matrix.Float
Slop matrix.Float
MaxCorrection matrix.Float
WarmStarting bool
AccumulatedImpulse matrix.Float
// Has unexported fields.
}
DistanceJoint keeps two body anchors, or one body anchor and one fixed world anchor, at a target distance. Nil bodies are treated as fixed world anchors.
NewDistanceJoint
func NewDistanceJoint(bodyA, bodyB *RigidBody, localAnchorA, localAnchorB matrix.Vec3) *DistanceJoint
NewDistanceJointAtWorldAnchors
func NewDistanceJointAtWorldAnchors(bodyA, bodyB *RigidBody, worldAnchorA, worldAnchorB matrix.Vec3) *DistanceJoint
NewDistanceJointToWorld
DistanceJoint.Constraint
DistanceJoint.CurrentLength
DistanceJoint.IsStretched
DistanceJoint.SetRestLength
DistanceJoint.SetWorldAnchors
DistanceJoint.WorldAnchorA
DistanceJoint.WorldAnchorB
Frustum
struct
Frustum.ExtractPlanes
FrustumCorners
FrustumExtractCorners
FrustumCorners.Center
HingeJoint
struct
type HingeJoint struct {
BodyA *RigidBody
BodyB *RigidBody
LocalAnchorA matrix.Vec3
LocalAnchorB matrix.Vec3
LocalAxisA matrix.Vec3
LocalAxisB matrix.Vec3
LocalRefA matrix.Vec3
LocalRefB matrix.Vec3
Stiffness matrix.Float
BiasFactor matrix.Float
PositionCorrectionFactor matrix.Float
Slop matrix.Float
MaxCorrection matrix.Float
WarmStarting bool
EnableLimits bool
MinAngle matrix.Float
MaxAngle matrix.Float
EnableMotor bool
MotorTargetSpeed matrix.Float
MaxMotorImpulse matrix.Float
MaxMotorTorque matrix.Float
AccumulatedAnchorImpulse matrix.Vec3
AccumulatedAngularImpulse matrix.Vec2
AccumulatedLimitImpulse matrix.Float
AccumulatedMotorImpulse matrix.Float
// Has unexported fields.
}
HingeJoint keeps two anchors coincident and aligns each body's hinge axis. Relative rotation is constrained around the two axes perpendicular to the hinge, leaving rotation around the hinge axis free.
NewHingeJoint
func NewHingeJoint(bodyA, bodyB *RigidBody, localAnchorA, localAnchorB, localAxisA, localAxisB matrix.Vec3) *HingeJoint
NewHingeJointAtWorldAnchor
func NewHingeJointAtWorldAnchor(bodyA, bodyB *RigidBody, worldAnchor, worldAxis matrix.Vec3) *HingeJoint
NewHingeJointToWorld
func NewHingeJointToWorld(body *RigidBody, localAnchor, worldAnchor, localAxis, worldAxis matrix.Vec3) *HingeJoint
HingeJoint.AccumulatedAngularImpulseMagnitude
HingeJoint.Constraint
HingeJoint.CurrentAnchorError
HingeJoint.CurrentAngle
HingeJoint.CurrentAngularError
HingeJoint.CurrentAngularVelocity
HingeJoint.DisableAngularLimits
HingeJoint.DisableMotor
HingeJoint.IsStretched
HingeJoint.SetAngularLimits
HingeJoint.SetMotor
HingeJoint.SetMotorTorque
HingeJoint.SetWorldAnchors
HingeJoint.SetWorldAxis
HingeJoint.WorldAnchorA
HingeJoint.WorldAnchorB
HingeJoint.WorldAxisA
HingeJoint.WorldAxisB
HingeJoint.WorldReferenceA
HingeJoint.WorldReferenceB
Hit
struct
HitObject
interface
type HitObject interface {
Bounds() AABB
RayIntersectTest(ray Ray, length float32, transform *matrix.Transform) (matrix.Vec3, bool)
}
Interval
struct
type Interval struct {
Min matrix.Float
Max matrix.Float
Body *RigidBody
// Has unexported fields.
}
Interval represents a projected AABB onto one axis
Mass
struct
MeshCollision
struct
MeshCollision stores the heavy collision data for triangle meshes. The flat Shape keeps only type and bounds so primitive shape data stays compact.
NewMeshCollision
NewMeshCollisionFromVertices
MeshCollision.ForEachWorldTriangle
func (m *MeshCollision) ForEachWorldTriangle(transform *matrix.Transform, visit func(DetailedTriangle) bool)
MeshCollision.Raycast
func (m *MeshCollision) Raycast(ray Ray, length matrix.Float, transform *matrix.Transform) (Hit, bool)
MotionState
struct
type MotionState struct {
Acceleration matrix.Vec3
AngularAcceleration matrix.Vec3
LinearVelocity matrix.Vec3
AngularVelocity matrix.Vec3
}
NarrowPhase
struct
NarrowPhase performs exact pair tests after the broad phase has produced candidate pairs. It owns reusable buffers so a physics step can run without per-pair allocations.
NarrowPhase.Collide
NarrowPhase.Manifolds
NarrowPhase.Reset
OOBB
NewOOBB
OOBBFromAABB
OOBBFromTransform
OOBB.Bounds
OOBB.ContainsPoint
OOBB.Corners
OOBB.Intersect
OOBB.RayIntersect
Octree
struct
type Octree struct {
Center matrix.Vec3
HalfWidth matrix.Float
Children [8]*Octree
Objects []HitObject
}
NewOctree
OctreeForMesh
Octree.AsAABB
Octree.Insert
Plane
struct
PlaneCCW
PlaneCCW creates a plane from three points in counter clockwise order
Plane.ClosestPoint
ClosestPoint returns the closest point on the plane to the given point
Plane.Distance
Distance returns the distance from the plane to the given point
Plane.SetFloatValue
SetFloatValue sets the value of the plane at the given index (X, Y, Z, Dot)
Plane.ToArray
ToArray converts the plane to an array of 4 floats
Plane.ToVec4
ToVec4 converts the plane to a Vec4 (analogous to ToArray)
PointJoint
struct
type PointJoint struct {
BodyA *RigidBody
BodyB *RigidBody
LocalAnchorA matrix.Vec3
LocalAnchorB matrix.Vec3
Stiffness matrix.Float
BiasFactor matrix.Float
PositionCorrectionFactor matrix.Float
Slop matrix.Float
MaxCorrection matrix.Float
WarmStarting bool
AccumulatedImpulse matrix.Vec3
// Has unexported fields.
}
PointJoint keeps two local anchors coincident while leaving relative orientation unconstrained. Nil bodies are treated as fixed world anchors.
NewPointJoint
NewPointJointAtWorldAnchors
func NewPointJointAtWorldAnchors(bodyA, bodyB *RigidBody, worldAnchorA, worldAnchorB matrix.Vec3) *PointJoint
NewPointJointToWorld
PointJoint.Constraint
PointJoint.CurrentError
PointJoint.IsStretched
PointJoint.SetWorldAnchors
PointJoint.WorldAnchorA
PointJoint.WorldAnchorB
Ray
struct
Ray.PlaneHit
PlaneHit returns the point of intersection with the plane and true if the ray hits the plane
Ray.Point
Point returns the point at the given distance along the ray
Ray.SphereHit
SphereHit returns true if the ray hits the sphere
Ray.TriangleHit
TriangleHit returns true if the ray hits the triangle defined by the three points
RigidBody
struct
type RigidBody struct {
Transform matrix.Transform
MotionState MotionState
Mass Mass
Collision CollisionInfo
Simulation SimulationState
Active bool
// Has unexported fields.
}
RigidBody.ApplyForce
ApplyForce applies a continuous world-space force at the body's center of mass.
RigidBody.ApplyForceAtPoint
ApplyForceAtPoint applies a continuous world-space force at a world-space point.
RigidBody.ApplyImpulse
ApplyImpulse applies an immediate world-space impulse at the body's center of mass.
RigidBody.ApplyImpulseAtPoint
ApplyImpulseAtPoint applies an immediate world-space impulse at a world-space point.
RigidBody.CollisionFilter
RigidBody.IsDynamic
RigidBody.IsKinematic
RigidBody.IsStatic
RigidBody.IsTrigger
RigidBody.Position
RigidBody.Rotation
RigidBody.SetCollisionFilter
RigidBody.SetDynamic
RigidBody.SetKinematic
SetKinematic makes this body entity-driven: the stage sync copies the entity transform into the body before collision detection, and the solver treats it as immovable because kinematic bodies have no inverse mass.
RigidBody.SetMass
RigidBody.SetShape
RigidBody.SetStatic
RigidBody.SetStaticMesh
RigidBody.SetStaticTerrain
RigidBody.SetTrigger
RigidBody.Shape
RigidBody.Sleep
RigidBody.Wake
RigidBody.WorldAABB
RigidBodyType
const ( RigidBodyTypeStatic RigidBodyType = iota RigidBodyTypeKinematic RigidBodyTypeDynamic )
RopeJoint
struct
type RopeJoint struct {
BodyA *RigidBody
BodyB *RigidBody
LocalAnchorA matrix.Vec3
LocalAnchorB matrix.Vec3
MaxLength matrix.Float
Stiffness matrix.Float
BiasFactor matrix.Float
PositionCorrectionFactor matrix.Float
Slop matrix.Float
MaxCorrection matrix.Float
WarmStarting bool
AccumulatedImpulse matrix.Float
// Has unexported fields.
}
RopeJoint keeps two anchors from separating beyond MaxLength. Unlike a DistanceJoint, it is inactive while the anchors are within the limit.
NewRopeJoint
NewRopeJointAtWorldAnchors
func NewRopeJointAtWorldAnchors(bodyA, bodyB *RigidBody, worldAnchorA, worldAnchorB matrix.Vec3) *RopeJoint
NewRopeJointToWorld
RopeJoint.Constraint
RopeJoint.CurrentLength
RopeJoint.IsSlack
RopeJoint.IsStretched
RopeJoint.SetMaxLength
RopeJoint.SetWorldAnchors
RopeJoint.WorldAnchorA
RopeJoint.WorldAnchorB
Segment
struct
LineSegmentFromRay
LineSegmentFromRay creates a line segment from a ray
Segment.TriangleHit
TriangleHit returns true if the segment hits the triangle defined by the three points
Shape
struct
type Shape struct {
Center matrix.Vec3 // Circle, AABB, OOBB, Capsule, Cylinder, Cone
Radius matrix.Float // Circle, Capsule, Cylinder, Cone
Extent matrix.Vec3 // AABB, OOBB
Orientation matrix.Mat3 // OOBB
Height matrix.Float // Capsule, Cylinder, Cone
Direction matrix.Vec3 // Capsule, Cylinder, Cone
Type ShapeType
}
NewAABBShape
NewBoxShape
NewCapsuleShape
NewConeShape
NewCylinderShape
NewMeshShape
NewOOBBShape
NewSphereShape
NewTerrainShape
Shape.SetAABB
Shape.SetAABBShape
Shape.SetBoxShape
Shape.SetCapsule
func (s *Shape) SetCapsule(center matrix.Vec3, radius matrix.Float, height matrix.Float, direction matrix.Vec3)
Shape.SetCapsuleShape
Shape.SetCone
func (s *Shape) SetCone(center matrix.Vec3, radius matrix.Float, height matrix.Float, direction matrix.Vec3)
Shape.SetConeShape
Shape.SetCylinder
func (s *Shape) SetCylinder(center matrix.Vec3, radius matrix.Float, height matrix.Float, direction matrix.Vec3)
Shape.SetCylinderShape
Shape.SetMesh
Shape.SetOOBB
Shape.SetOOBBShape
Shape.SetSphere
Shape.SetSphereShape
Shape.SetTerrain
ShapeType
const ( ShapeTypeSphere ShapeType = iota ShapeTypeAABB ShapeTypeOOBB ShapeTypeCapsule ShapeTypeCylinder ShapeTypeCone ShapeTypeMesh ShapeTypeTerrain )
SimulationState
struct
type SimulationState struct {
Type RigidBodyType
SleepThreshold matrix.Float
SleepTimer matrix.Float
IsSleeping bool
IsFixedRotation bool
IsFixedPosition bool
// Has unexported fields.
}
Sphere
NewSphere
Sphere.IntersectsAABB
Sphere.IntersectsCapsule
Sphere.IntersectsCone
Sphere.IntersectsCylinder
Sphere.IntersectsFrustum
Sphere.IntersectsOOBB
Sphere.IntersectsPlane
Sphere.IntersectsRay
Sphere.IntersectsSphere
SweepPrune
struct
SweepPrune.Initialize
SweepPrune.Rebuild
SweepPrune.RebuildParallel
func (s *SweepPrune) RebuildParallel(bodies *pooling.PoolGroup[RigidBody], threads *concurrent.Threads)
SweepPrune.Sweep
SweepPrune.SweepParallel
func (s *SweepPrune) SweepParallel(threads *concurrent.Threads, filter BroadPhaseFilter) []ActivePair
System
struct
type System struct {
// Constraint iteration counts are shared by contact and constraint solving
// because System.Step solves them together in the same islands.
ConstraintVelocityIterations int
ConstraintPositionIterations int
// Has unexported fields.
}
System.AddBody
System.AddConstraint
System.AddConstraintWithBodies
func (s *System) AddConstraintWithBodies(constraint *Constraint, bodyA, bodyB *RigidBody) *Constraint
System.AddDistanceJoint
System.AddHingeJoint
System.AddPointJoint
System.AddRopeJoint
System.Clear
System.ClearConstraints
System.Constraints
Constraints returns the constraints currently stored in the System. The returned slice is owned by the System and is reused on the next constraints query or Step.
System.Contacts
Contacts returns the contact manifolds generated during the most recent Step. The returned slice is owned by the System and is reused on the next Step.
System.Initialize
System.NewBody
System.NewConstraint
System.NewDistanceJoint
func (s *System) NewDistanceJoint(bodyA, bodyB *RigidBody, localAnchorA, localAnchorB matrix.Vec3) *DistanceJoint
System.NewDistanceJointAtWorldAnchors
func (s *System) NewDistanceJointAtWorldAnchors(bodyA, bodyB *RigidBody, worldAnchorA, worldAnchorB matrix.Vec3) *DistanceJoint
System.NewDistanceJointToWorld
func (s *System) NewDistanceJointToWorld(body *RigidBody, localAnchor, worldAnchor matrix.Vec3) *DistanceJoint
System.NewHingeJoint
func (s *System) NewHingeJoint(bodyA, bodyB *RigidBody, localAnchorA, localAnchorB, localAxisA, localAxisB matrix.Vec3) *HingeJoint
System.NewHingeJointAtWorldAnchor
func (s *System) NewHingeJointAtWorldAnchor(bodyA, bodyB *RigidBody, worldAnchor, worldAxis matrix.Vec3) *HingeJoint
System.NewHingeJointToWorld
func (s *System) NewHingeJointToWorld(body *RigidBody, localAnchor, worldAnchor, localAxis, worldAxis matrix.Vec3) *HingeJoint
System.NewPointJoint
func (s *System) NewPointJoint(bodyA, bodyB *RigidBody, localAnchorA, localAnchorB matrix.Vec3) *PointJoint
System.NewPointJointAtWorldAnchors
func (s *System) NewPointJointAtWorldAnchors(bodyA, bodyB *RigidBody, worldAnchorA, worldAnchorB matrix.Vec3) *PointJoint
System.NewPointJointToWorld
func (s *System) NewPointJointToWorld(body *RigidBody, localAnchor, worldAnchor matrix.Vec3) *PointJoint
System.NewRopeJoint
func (s *System) NewRopeJoint(bodyA, bodyB *RigidBody, localAnchorA, localAnchorB matrix.Vec3) *RopeJoint
System.NewRopeJointAtWorldAnchors
func (s *System) NewRopeJointAtWorldAnchors(bodyA, bodyB *RigidBody, worldAnchorA, worldAnchorB matrix.Vec3) *RopeJoint
System.NewRopeJointToWorld
func (s *System) NewRopeJointToWorld(body *RigidBody, localAnchor, worldAnchor matrix.Vec3) *RopeJoint
System.Raycast
System.RemoveBody
RemoveBody releases a body and disables any constraints attached to it. The disabled constraints remain in constraint storage until explicitly removed or cleared, with the removed body endpoint set to nil.
System.RemoveConstraint
System.RemoveDistanceJoint
System.RemoveHingeJoint
System.RemovePointJoint
System.RemoveRopeJoint
System.SetGravity
System.SphereSweep
System.Step
func (s *System) Step(workGroup *concurrent.WorkGroup, threads *concurrent.Threads, deltaTime float64)
TerrainCollision
struct
type TerrainCollision struct {
Resolution int
WorldSize matrix.Vec2
Heights []matrix.Float
MinHeight matrix.Float
MaxHeight matrix.Float
Bounds AABB
}
NewTerrainCollision
func NewTerrainCollision(resolution int, worldSize matrix.Vec2, heights []matrix.Float, minHeight, maxHeight matrix.Float) (*TerrainCollision, error)
NewTerrainCollisionCopy
func NewTerrainCollisionCopy(resolution int, worldSize matrix.Vec2, heights []matrix.Float, minHeight, maxHeight matrix.Float) (*TerrainCollision, error)
TerrainCollision.CellRangeForLocalAABB
TerrainCollision.ForEachTriangleInLocalAABB
func (c *TerrainCollision) ForEachTriangleInLocalAABB(bounds AABB, visit func(DetailedTriangle) bool)
TerrainCollision.GridToLocal
TerrainCollision.Height
TerrainCollision.HeightAtLocal
TerrainCollision.LocalBounds
TerrainCollision.LocalToGrid
TerrainCollision.NormalAtLocal
TerrainCollision.Raycast
func (c *TerrainCollision) Raycast(ray Ray, length matrix.Float, transform *matrix.Transform) (Hit, bool)
TerrainCollision.RefreshBounds
TerrainCollision.SampleGrid
Triangle
struct
TriangleBVH
struct
type TriangleBVH struct {
Bounds AABB
Left *TriangleBVH
Right *TriangleBVH
Triangle DetailedTriangle
HasTriangle bool
}