Skip to content

package physics

import "kaiju/physics"

Types

BoxShape

struct

type BoxShape struct{ CollisionShape }

NewBoxShape

func NewBoxShape(size matrix.Vec3) *BoxShape

BroadphaseInterface

struct

type BroadphaseInterface struct {
    // Has unexported fields.
}

NewBroadphaseInterface

func NewBroadphaseInterface() *BroadphaseInterface

CapsuleShape

struct

type CapsuleShape struct{ CollisionShape }

NewCapsuleShape

func NewCapsuleShape(radius, height float32) *CapsuleShape

CollisionDispatcher

struct

type CollisionDispatcher struct {
    // Has unexported fields.
}

NewCollisionDispatcher

func NewCollisionDispatcher(collisionConfig *DefaultCollisionConfiguration) *CollisionDispatcher

CollisionHit

C.HitWrapper

type CollisionHit C.HitWrapper

CollisionHit.IsValid

func (c *CollisionHit) IsValid() bool

CollisionHit.Normal

func (c *CollisionHit) Normal() matrix.Vec3

CollisionHit.Object

func (c *CollisionHit) Object() CollisionObject

CollisionHit.Point

func (c *CollisionHit) Point() matrix.Vec3

CollisionObject

struct

type CollisionObject struct {
    // Has unexported fields.
}

CollisionShape

struct

type CollisionShape struct {
    // Has unexported fields.
}

CollisionShape.CalculateLocalInertia

func (s *CollisionShape) CalculateLocalInertia(mass float32) matrix.Vec3

CompoundShape

struct

type CompoundShape struct{ CollisionShape }

NewCompoundShape

func NewCompoundShape(initialChildCapacity int, enableDynamicAABBTree bool) *CompoundShape

ConeShape

struct

type ConeShape struct{ CollisionShape }

NewConeShape

func NewConeShape(radius, height float32) *ConeShape

ConvexHullShape

struct

type ConvexHullShape struct{ ConvexShape }

NewConvexHullShape

func NewConvexHullShape(points []float32, stride int) *ConvexHullShape

ConvexShape

struct

type ConvexShape struct{ CollisionShape }

CylinderShape

struct

type CylinderShape struct{ CollisionShape }

NewnCylinderShape

func NewnCylinderShape(halfExtents matrix.Vec3) *CylinderShape

DefaultCollisionConfiguration

struct

type DefaultCollisionConfiguration struct {
    // Has unexported fields.
}

NewDefaultCollisionConfiguration

func NewDefaultCollisionConfiguration() *DefaultCollisionConfiguration

EmptyShape

struct

type EmptyShape struct{ CollisionShape }

NewEmptyShape

func NewEmptyShape(size matrix.Vec3) *EmptyShape

MotionState

struct

type MotionState struct {
    // Has unexported fields.
}

NewDefaultMotionState

func NewDefaultMotionState(rot matrix.Quaternion, centerOfMass matrix.Vec3) *MotionState

MultiSphereShape

struct

type MultiSphereShape struct{ CollisionShape }

NewMultiSphereShape

func NewMultiSphereShape(positions []matrix.Vec3, radii []float32) *MultiSphereShape

RigidBody

struct

type RigidBody struct {
    // Has unexported fields.
}

NewRigidBody

func NewRigidBody(mass float32, motion *MotionState, shape *CollisionShape, inertia matrix.Vec3) *RigidBody

RigidBody.ApplyForceAtPoint

func (r *RigidBody) ApplyForceAtPoint(force, point matrix.Vec3)

RigidBody.ApplyImpulseAtPoint

func (r *RigidBody) ApplyImpulseAtPoint(force, point matrix.Vec3)

RigidBody.IsCollisionObject

func (r *RigidBody) IsCollisionObject(obj CollisionObject) bool

RigidBody.Position

func (r *RigidBody) Position() matrix.Vec3

RigidBody.Rotation

func (r *RigidBody) Rotation() matrix.Quaternion

RigidBody.Shape

func (r *RigidBody) Shape() *CollisionShape

SequentialImpulseConstraintSolver

struct

type SequentialImpulseConstraintSolver struct {
    // Has unexported fields.
}

NewSequentialImpulseConstraintSolver

func NewSequentialImpulseConstraintSolver() *SequentialImpulseConstraintSolver

SphereShape

struct

type SphereShape struct{ CollisionShape }

NewSphereShape

func NewSphereShape(radius float32) *SphereShape

StaticPlaneShape

struct

type StaticPlaneShape struct{ CollisionShape }

NewStaticPlaneShape

func NewStaticPlaneShape(normal matrix.Vec3, constant float32) *StaticPlaneShape

UniformScalingShape

struct

type UniformScalingShape struct{ CollisionShape }

NewUniformScalingShape

func NewUniformScalingShape(convexChildShape *ConvexShape, scaleFactor float32) *UniformScalingShape

World

struct

type World struct {
    // Has unexported fields.
}

NewDiscreteDynamicsWorld

func NewDiscreteDynamicsWorld(dispatcher *CollisionDispatcher, broadphase *BroadphaseInterface, solver *SequentialImpulseConstraintSolver, collisionConfig *DefaultCollisionConfiguration) *World

World.AddRigidBody

func (w *World) AddRigidBody(body *RigidBody)

World.Raycast

func (w *World) Raycast(from, to matrix.Vec3) CollisionHit

World.RemoveRigidBody

func (w *World) RemoveRigidBody(body *RigidBody)

World.SetGravity

func (w *World) SetGravity(v matrix.Vec3)

World.SphereSweep

func (w *World) SphereSweep(from, to matrix.Vec3, radius float32) CollisionHit

World.StepSimulation

func (w *World) StepSimulation(timeStep float32)