constraint

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCompliance controls soft constraint stiffness for contact resolution.
	// Lower values = stiffer contacts (less penetration, potential jitter)
	// Higher values = softer contacts (more penetration, smoother)
	// Typical range: 1e-10 (very stiff) to 1e-6 (soft)
	// See PHYSICS_GUIDE.md for tuning guidelines.
	DefaultCompliance = 1e-7
)

Variables

This section is empty.

Functions

func ComputeDynamicFriction

func ComputeDynamicFriction(matA, matB actor.Material) float64

func ComputeRestitution

func ComputeRestitution(matA, matB actor.Material) float64

func ComputeStaticFriction

func ComputeStaticFriction(matA, matB actor.Material) float64

Types

type Constraint

type Constraint interface {
	SolvePosition(dt float64)
	SolveVelocity(dt float64)
}

type ContactConstraint

type ContactConstraint struct {
	BodyA  *actor.RigidBody
	BodyB  *actor.RigidBody
	Points []ContactPoint
	Normal mgl64.Vec3
}

func (*ContactConstraint) SolvePosition

func (c *ContactConstraint) SolvePosition(dt float64)

SolvePosition resolves penetration (PBD style, no lambda accumulation)

func (*ContactConstraint) SolveVelocity

func (c *ContactConstraint) SolveVelocity(dt float64)

SolveVelocity applies restitution

type ContactPoint

type ContactPoint struct {
	Position    mgl64.Vec3
	Penetration float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL