engine: github.com/g3n/engine/experimental/physics/constraint Index | Files

package constraint

import "github.com/g3n/engine/experimental/physics/constraint"

Package constraint implements physics constraints.

Index

Package Files

conetwist.go constraint.go distance.go hinge.go lock.go pointtopoint.go

type ConeTwist Uses

type ConeTwist struct {
    PointToPoint
    // contains filtered or unexported fields
}

ConeTwist constraint.

func NewConeTwist Uses

func NewConeTwist(bodyA, bodyB IBody, pivotA, pivotB, axisA, axisB *math32.Vector3, angle, twistAngle, maxForce float32) *ConeTwist

NewConeTwist creates and returns a pointer to a new ConeTwist constraint object.

func (*ConeTwist) Update Uses

func (ctc *ConeTwist) Update()

Update updates the equations with data.

type Constraint Uses

type Constraint struct {
    // contains filtered or unexported fields
}

Constraint base struct.

func (*Constraint) AddEquation Uses

func (c *Constraint) AddEquation(eq equation.IEquation)

AddEquation adds an equation to the constraint.

func (*Constraint) BodyA Uses

func (c *Constraint) BodyA() IBody

func (*Constraint) BodyB Uses

func (c *Constraint) BodyB() IBody

func (*Constraint) CollideConnected Uses

func (c *Constraint) CollideConnected() bool

func (*Constraint) Equations Uses

func (c *Constraint) Equations() []equation.IEquation

Equations returns the constraint's equations.

func (*Constraint) SetEnabled Uses

func (c *Constraint) SetEnabled(state bool)

SetEnable sets the enabled flag of the constraint equations.

type Distance Uses

type Distance struct {
    Constraint
    // contains filtered or unexported fields
}

Distance is a distance constraint. Constrains two bodies to be at a constant distance from each others center of mass.

func NewDistance Uses

func NewDistance(bodyA, bodyB IBody, distance, maxForce float32) *Distance

NewDistance creates and returns a pointer to a new Distance constraint object.

func (*Distance) Update Uses

func (dc *Distance) Update()

Update updates the equation with data.

type Hinge Uses

type Hinge struct {
    PointToPoint
    // contains filtered or unexported fields
}

Hinge constraint. Think of it as a door hinge. It tries to keep the door in the correct place and with the correct orientation.

func NewHinge Uses

func NewHinge(bodyA, bodyB IBody, pivotA, pivotB, axisA, axisB *math32.Vector3, maxForce float32) *Hinge

NewHinge creates and returns a pointer to a new Hinge constraint object.

func (*Hinge) SetMotorEnabled Uses

func (hc *Hinge) SetMotorEnabled(state bool)

func (*Hinge) SetMotorMaxForce Uses

func (hc *Hinge) SetMotorMaxForce(maxForce float32)

func (*Hinge) SetMotorSpeed Uses

func (hc *Hinge) SetMotorSpeed(speed float32)

func (*Hinge) Update Uses

func (hc *Hinge) Update()

Update updates the equations with data.

type IBody Uses

type IBody interface {
    equation.IBody
    WakeUp()
    VectorToWorld(*math32.Vector3) math32.Vector3
    PointToLocal(*math32.Vector3) math32.Vector3
    VectorToLocal(*math32.Vector3) math32.Vector3
    Quaternion() *math32.Quaternion
}

type IConstraint Uses

type IConstraint interface {
    Update() // Update all the equations with data.
    Equations() []equation.IEquation
    CollideConnected() bool
    BodyA() IBody
    BodyB() IBody
}

type Lock Uses

type Lock struct {
    PointToPoint
    // contains filtered or unexported fields
}

Lock constraint. Removes all degrees of freedom between the bodies.

func NewLock Uses

func NewLock(bodyA, bodyB IBody, maxForce float32) *Lock

NewLock creates and returns a pointer to a new Lock constraint object.

func (*Lock) Update Uses

func (lc *Lock) Update()

Update updates the equations with data.

type PointToPoint Uses

type PointToPoint struct {
    Constraint
    // contains filtered or unexported fields
}

PointToPoint is an offset constraint. Connects two bodies at the specified offset points.

func NewPointToPoint Uses

func NewPointToPoint(bodyA, bodyB IBody, pivotA, pivotB *math32.Vector3, maxForce float32) *PointToPoint

NewPointToPoint creates and returns a pointer to a new PointToPoint constraint object.

func (*PointToPoint) Update Uses

func (ptpc *PointToPoint) Update()

Update updates the equations with data.

Package constraint imports 2 packages (graph) and is imported by 1 packages. Updated 2018-07-24. Refresh now. Tools for package owners.