Documentation ¶
Overview ¶
Package constraint implements physics constraints.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConeTwist ¶
type ConeTwist struct { PointToPoint // contains filtered or unexported fields }
ConeTwist constraint.
type Constraint ¶
type Constraint struct {
// contains filtered or unexported fields
}
Constraint base struct.
func (*Constraint) AddEquation ¶
func (c *Constraint) AddEquation(eq equation.IEquation)
AddEquation adds an equation to the constraint.
func (*Constraint) BodyA ¶
func (c *Constraint) BodyA() IBody
func (*Constraint) BodyB ¶
func (c *Constraint) BodyB() IBody
func (*Constraint) CollideConnected ¶
func (c *Constraint) CollideConnected() bool
func (*Constraint) Equations ¶
func (c *Constraint) Equations() []equation.IEquation
Equations returns the constraint's equations.
func (*Constraint) SetEnabled ¶
func (c *Constraint) SetEnabled(state bool)
SetEnable sets the enabled flag of the constraint equations.
type Distance ¶
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 ¶
NewDistance creates and returns a pointer to a new Distance constraint object.
type Hinge ¶
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 ¶
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 ¶
func (*Hinge) SetMotorMaxForce ¶
func (*Hinge) SetMotorSpeed ¶
type IConstraint ¶
type Lock ¶
type Lock struct { PointToPoint // contains filtered or unexported fields }
Lock constraint. Removes all degrees of freedom between the bodies.
type PointToPoint ¶
type PointToPoint struct { Constraint // contains filtered or unexported fields }
PointToPoint is an offset constraint. Connects two bodies at the specified offset points.
func NewPointToPoint ¶
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 ¶
func (ptpc *PointToPoint) Update()
Update updates the equations with data.