Documentation
¶
Index ¶
- func SymmetricMomentOfInertia(value float32) sprec.Mat3
- type Body
- func (b *Body) AddAcceleration(amount sprec.Vec3)
- func (b *Body) AddAngularAcceleration(amount sprec.Vec3)
- func (b *Body) AddAngularVelocity(amount sprec.Vec3)
- func (b *Body) AddVelocity(amount sprec.Vec3)
- func (b *Body) ApplyAngularImpulse(impulse sprec.Vec3)
- func (b *Body) ApplyAngularNudge(nudge sprec.Vec3)
- func (b *Body) ApplyForce(force sprec.Vec3)
- func (b *Body) ApplyImpulse(impulse sprec.Vec3)
- func (b *Body) ApplyNudge(nudge sprec.Vec3)
- func (b *Body) ApplyOffsetForce(offset, force sprec.Vec3)
- func (b *Body) ApplyOffsetImpulse(offset, impulse sprec.Vec3)
- func (b *Body) ApplyTorque(torque sprec.Vec3)
- func (b *Body) ResetAcceleration()
- func (b *Body) ResetAngularAcceleration()
- func (b *Body) Rotate(vector sprec.Vec3)
- func (b *Body) Translate(offset sprec.Vec3)
- type ChandelierConstraint
- type ChandelierConstraintResult
- type CoiloverConstraint
- type Constraint
- type Context
- type Engine
- type FixedTranslationConstraint
- type FixedTranslationConstraintResult
- type GroundCollisionConstraint
- type HingedRodConstraint
- type HingedRodConstraintResult
- type Jacobian
- func (j Jacobian) ApplyImpulse(body *Body, lambda float32)
- func (j Jacobian) ApplyNudge(body *Body, lambda float32)
- func (j Jacobian) CorrectPosition(body *Body, drift float32)
- func (j Jacobian) CorrectVelocity(body *Body)
- func (j Jacobian) EffectiveVelocity(body *Body) float32
- func (j Jacobian) InverseEffectiveMass(body *Body) float32
- type LimitTranslationConstraint
- type MatchAxisConstraint
- type MatchAxisConstraintResult
- type MatchRotationConstraint
- type MatchTranslationConstraint
- type MatchTranslationResultConstraint
- type NilConstraint
- type PairJacobian
- func (j PairJacobian) ApplyImpulse(firstBody, secondBody *Body, lambda float32)
- func (j PairJacobian) ApplyNudge(firstBody, secondBody *Body, lambda float32)
- func (j PairJacobian) CorrectPosition(firstBody, secondBody *Body, drift float32)
- func (j PairJacobian) CorrectVelocity(firstBody, secondBody *Body)
- func (j PairJacobian) EffectiveVelocity(firstBody, secondBody *Body) float32
- func (j PairJacobian) InverseEffectiveMass(firstBody, secondBody *Body) float32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Body ¶
type Body struct {
Name string
Position sprec.Vec3
Orientation sprec.Quat
IsStatic bool
Mass float32
MomentOfInertia sprec.Mat3
Acceleration sprec.Vec3
AngularAcceleration sprec.Vec3
Velocity sprec.Vec3
AngularVelocity sprec.Vec3
DragFactor float32
AngularDragFactor float32
RestitutionCoef float32
CollisionShapes []shape.Placement
InCollision bool
}
func (*Body) AddAcceleration ¶
func (*Body) AddAngularAcceleration ¶
func (*Body) AddAngularVelocity ¶
func (*Body) AddVelocity ¶
func (*Body) ApplyAngularImpulse ¶
func (*Body) ApplyAngularNudge ¶
func (*Body) ApplyForce ¶
func (*Body) ApplyImpulse ¶
func (*Body) ApplyNudge ¶
func (*Body) ApplyOffsetForce ¶
func (*Body) ApplyOffsetImpulse ¶
func (*Body) ApplyTorque ¶
func (*Body) ResetAcceleration ¶
func (b *Body) ResetAcceleration()
func (*Body) ResetAngularAcceleration ¶
func (b *Body) ResetAngularAcceleration()
type ChandelierConstraint ¶
type ChandelierConstraint struct {
NilConstraint
Fixture sprec.Vec3
Body *Body
BodyAnchor sprec.Vec3
Length float32
}
func (ChandelierConstraint) ApplyImpulse ¶
func (c ChandelierConstraint) ApplyImpulse(ctx Context)
func (ChandelierConstraint) ApplyNudge ¶
func (c ChandelierConstraint) ApplyNudge(ctx Context)
func (ChandelierConstraint) Calculate ¶
func (c ChandelierConstraint) Calculate() ChandelierConstraintResult
type CoiloverConstraint ¶
type CoiloverConstraint struct {
NilConstraint
FirstBody *Body
FirstBodyAnchor sprec.Vec3
SecondBody *Body
FrequencyHz float32
DampingRatio float32
// contains filtered or unexported fields
}
func (*CoiloverConstraint) ApplyImpulse ¶
func (c *CoiloverConstraint) ApplyImpulse(ctx Context)
func (*CoiloverConstraint) Reset ¶
func (c *CoiloverConstraint) Reset()
type Constraint ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) AddConstraint ¶
func (e *Engine) AddConstraint(constraint Constraint)
type FixedTranslationConstraint ¶
type FixedTranslationConstraint struct {
NilConstraint
Fixture sprec.Vec3
Body *Body
}
func (FixedTranslationConstraint) ApplyImpulse ¶
func (c FixedTranslationConstraint) ApplyImpulse(ctx Context)
func (FixedTranslationConstraint) ApplyNudge ¶
func (c FixedTranslationConstraint) ApplyNudge(ctx Context)
func (FixedTranslationConstraint) Calculate ¶
func (c FixedTranslationConstraint) Calculate() FixedTranslationConstraintResult
type GroundCollisionConstraint ¶
type GroundCollisionConstraint struct {
NilConstraint
Body *Body
Normal sprec.Vec3
ContactPoint sprec.Vec3
Depth float32
}
func (GroundCollisionConstraint) ApplyImpulse ¶
func (c GroundCollisionConstraint) ApplyImpulse(ctx Context)
type HingedRodConstraint ¶
type HingedRodConstraint struct {
NilConstraint
FirstBody *Body
FirstBodyAnchor sprec.Vec3
SecondBody *Body
SecondBodyAnchor sprec.Vec3
Length float32
}
func (HingedRodConstraint) ApplyImpulse ¶
func (c HingedRodConstraint) ApplyImpulse(ctx Context)
func (HingedRodConstraint) ApplyNudge ¶
func (c HingedRodConstraint) ApplyNudge(ctx Context)
func (HingedRodConstraint) Calculate ¶
func (c HingedRodConstraint) Calculate() HingedRodConstraintResult
type HingedRodConstraintResult ¶
type HingedRodConstraintResult struct {
Jacobian PairJacobian
Drift float32
}
type Jacobian ¶
func (Jacobian) ApplyImpulse ¶
func (Jacobian) ApplyNudge ¶
func (Jacobian) CorrectPosition ¶
func (Jacobian) CorrectVelocity ¶
func (Jacobian) EffectiveVelocity ¶
func (Jacobian) InverseEffectiveMass ¶
type LimitTranslationConstraint ¶
type LimitTranslationConstraint struct {
NilConstraint
FirstBody *Body
SecondBody *Body
MinY float32
MaxY float32
}
func (LimitTranslationConstraint) ApplyImpulse ¶
func (c LimitTranslationConstraint) ApplyImpulse(ctx Context)
type MatchAxisConstraint ¶
type MatchAxisConstraint struct {
NilConstraint
FirstBody *Body
FirstBodyAxis sprec.Vec3
SecondBody *Body
SecondBodyAxis sprec.Vec3
}
func (MatchAxisConstraint) ApplyImpulse ¶
func (c MatchAxisConstraint) ApplyImpulse(ctx Context)
func (MatchAxisConstraint) ApplyNudge ¶
func (c MatchAxisConstraint) ApplyNudge(ctx Context)
func (MatchAxisConstraint) Calculate ¶
func (c MatchAxisConstraint) Calculate() MatchAxisConstraintResult
type MatchAxisConstraintResult ¶
type MatchAxisConstraintResult struct {
Jacobian PairJacobian
Drift float32
}
type MatchRotationConstraint ¶
type MatchRotationConstraint struct {
NilConstraint
FirstBody *Body
SecondBody *Body
}
func (MatchRotationConstraint) ApplyImpulse ¶
func (c MatchRotationConstraint) ApplyImpulse(ctx Context)
func (MatchRotationConstraint) ApplyNudge ¶
func (c MatchRotationConstraint) ApplyNudge(ctx Context)
type MatchTranslationConstraint ¶
type MatchTranslationConstraint struct {
NilConstraint
FirstBody *Body
FirstBodyAnchor sprec.Vec3
SecondBody *Body
IgnoreX bool
IgnoreY bool
IgnoreZ bool
}
func (MatchTranslationConstraint) ApplyImpulse ¶
func (c MatchTranslationConstraint) ApplyImpulse(ctx Context)
func (MatchTranslationConstraint) ApplyNudge ¶
func (c MatchTranslationConstraint) ApplyNudge(ctx Context)
func (MatchTranslationConstraint) Calculate ¶
func (c MatchTranslationConstraint) Calculate() MatchTranslationResultConstraint
type MatchTranslationResultConstraint ¶
type MatchTranslationResultConstraint struct {
Jacobian PairJacobian
Drift float32
}
type NilConstraint ¶
type NilConstraint struct{}
func (NilConstraint) ApplyImpulse ¶
func (NilConstraint) ApplyImpulse(Context)
func (NilConstraint) ApplyNudge ¶
func (NilConstraint) ApplyNudge(Context)
func (NilConstraint) Reset ¶
func (NilConstraint) Reset()
type PairJacobian ¶
func (PairJacobian) ApplyImpulse ¶
func (j PairJacobian) ApplyImpulse(firstBody, secondBody *Body, lambda float32)
func (PairJacobian) ApplyNudge ¶
func (j PairJacobian) ApplyNudge(firstBody, secondBody *Body, lambda float32)
func (PairJacobian) CorrectPosition ¶
func (j PairJacobian) CorrectPosition(firstBody, secondBody *Body, drift float32)
func (PairJacobian) CorrectVelocity ¶
func (j PairJacobian) CorrectVelocity(firstBody, secondBody *Body)
func (PairJacobian) EffectiveVelocity ¶
func (j PairJacobian) EffectiveVelocity(firstBody, secondBody *Body) float32
func (PairJacobian) InverseEffectiveMass ¶
func (j PairJacobian) InverseEffectiveMass(firstBody, secondBody *Body) float32
Click to show internal directories.
Click to hide internal directories.