physics

package
v0.0.0-...-af59c4b Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateCuboidInertia

func CalculateCuboidInertia(width float64, height float64, depth float64, mass float64) *mathf.Vec3

func CalculateSphereInertia

func CalculateSphereInertia(radius float64, mass float64) *mathf.Vec3

Types

type RigidBody

type RigidBody struct {
	Mass float64

	// World space position of the body.
	Position *mathf.Vec3
	// World space rotational force on the body, around center of mass.
	Rotation *mathf.Quaternion

	// World space velocity of the body.
	Velocity *mathf.Vec3
	// Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates.
	AngularVelocity *mathf.Vec3

	// Linear force on the body in world space.
	Force *mathf.Vec3
	// World space rotational force on the body, around center of mass.
	Torque *mathf.Vec3

	// LinearFactor use to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none.
	LinearFactor *mathf.Vec3

	// AngularFactor use to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none.
	AngularFactor *mathf.Vec3

	// moment of inertia components
	Inertia             *mathf.Vec3
	InverseInertiaWorld *mathf.Mat3

	LinearDamping  float64
	AngularDamping float64
}

func NewRigidBody

func NewRigidBody() *RigidBody

func (*RigidBody) AddLocalTorque

func (rigidbody *RigidBody) AddLocalTorque(localTorque *mathf.Vec3)

func (*RigidBody) AddTorque

func (rigidbody *RigidBody) AddTorque(torque *mathf.Vec3)

func (*RigidBody) ApplyForce

func (rigidbody *RigidBody) ApplyForce(force *mathf.Vec3, relativePoint *mathf.Vec3)

func (*RigidBody) ApplyImpulse

func (rigidbody *RigidBody) ApplyImpulse(impulse *mathf.Vec3, relativePoint *mathf.Vec3)

func (*RigidBody) ApplyLocalForce

func (rigidbody *RigidBody) ApplyLocalForce(localForce *mathf.Vec3, localPoint *mathf.Vec3)

func (*RigidBody) ApplyLocalImpulse

func (rigidbody *RigidBody) ApplyLocalImpulse(localImpulse *mathf.Vec3, localPoint *mathf.Vec3)

func (*RigidBody) InverseInertia

func (rigidbody *RigidBody) InverseInertia() *mathf.Vec3

func (*RigidBody) InverseMass

func (rigidbody *RigidBody) InverseMass() float64

func (*RigidBody) PointToLocalFrame

func (rigidbody *RigidBody) PointToLocalFrame(worldPoint *mathf.Vec3) *mathf.Vec3

func (*RigidBody) PointToWorldFrame

func (rigidbody *RigidBody) PointToWorldFrame(localPoint *mathf.Vec3) *mathf.Vec3

func (*RigidBody) Update

func (rigidbody *RigidBody) Update(delta float64)

func (*RigidBody) UpdateInertiaWorld

func (rigidbody *RigidBody) UpdateInertiaWorld(force bool)

func (*RigidBody) VectorToLocalFrame

func (rigidbody *RigidBody) VectorToLocalFrame(worldVector *mathf.Vec3) *mathf.Vec3

func (*RigidBody) VectorToWorldFrame

func (rigidbody *RigidBody) VectorToWorldFrame(localVector *mathf.Vec3) *mathf.Vec3

Jump to

Keyboard shortcuts

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