Documentation
¶
Index ¶
- Variables
- func ApplyImpulse(dyn *Dynamics, linearImpulse, torqueArm vector.Two)
- func Integrate(dyn *Dynamics, position vector.TwoReader, rotation, dt float64) (newPosition vector.Two, newRotation float64)
- func IntegrateAngular(dyn *Dynamics, rotation float64, dt float64) (newRotation float64)
- func IntegrateLinear(dyn *Dynamics, pos vector.TwoReader, dt float64) (newPos vector.Two)
- type Dynamics
Constants ¶
This section is empty.
Variables ¶
var Components = components{ Dynamics: warehouse.FactoryNewComponent[Dynamics](), }
var Forces forcesHandler
Forces is the global forces handler instance
var Resolver resolver
Resolver is the global collision resolver instance
var VerticalResolver verticalResolver
VerticalResolver is the Global vertical collision resolver instance
Functions ¶
func ApplyImpulse ¶
ApplyImpulse applies both linear and angular impulse to a dynamics object
func Integrate ¶
func Integrate(dyn *Dynamics, position vector.TwoReader, rotation, dt float64) (newPosition vector.Two, newRotation float64)
Integrate updates position and rotation based on dynamics over the given time step
func IntegrateAngular ¶
IntegrateAngular calculates new rotation based on torque, angular acceleration and velocity
Types ¶
type Dynamics ¶
type Dynamics struct {
UnstoppableLinear, UnstoppableAngular bool
Accel, Vel, SumForces vector.Two
InverseMass float64
AngularVel, AngularAccel, SumTorque float64
InverseAngularMass float64
Friction, Elasticity float64
}
Dynamics represents the physical properties and state of a movable entity
func NewDynamics ¶
NewDynamics creates a new Dynamics component with the specified mass
func (*Dynamics) SetAngularMass ¶
SetAngularMass updates the inverse angular mass based on the provided angular mass
func (*Dynamics) SetDefaultAngularMass ¶
SetDefaultAngularMass calculates and sets appropriate angular mass based on shape type