ode

package
v0.0.0-...-793ea6c Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package ode provide a Go interface to the Open Dynamics Engine library. See the ODE documentation for more information.

Index

Constants

View Source
const (
	Mu2CtParam      = C.dContactMu2
	AxisDepCtParam  = C.dContactAxisDep
	FDir1CtParam    = C.dContactFDir1
	BounceCtParam   = C.dContactBounce
	SoftERPCtParam  = C.dContactSoftERP
	SoftCFMCtParam  = C.dContactSoftCFM
	Motion1CtParam  = C.dContactMotion1
	Motion2CtParam  = C.dContactMotion2
	MotionNCtParam  = C.dContactMotionN
	Slip1CtParam    = C.dContactSlip1
	Slip2CtParam    = C.dContactSlip2
	RollingCtParam  = C.dContactRolling
	Approx0CtParam  = C.dContactApprox0
	Approx11CtParam = C.dContactApprox1_1
	Approx12CtParam = C.dContactApprox1_2
	Approx1NCtParam = C.dContactApprox1_N
	Approx1CtParam  = C.dContactApprox1
)

Contact parameter types

View Source
const (
	SphereClass             = C.dSphereClass
	BoxClass                = C.dBoxClass
	CapsuleClass            = C.dCapsuleClass
	CylinderClass           = C.dCylinderClass
	PlaneClass              = C.dPlaneClass
	RayClass                = C.dRayClass
	ConvexClass             = C.dConvexClass
	TriMeshClass            = C.dTriMeshClass
	HeightfieldClass        = C.dHeightfieldClass
	SimpleSpaceClass        = C.dSimpleSpaceClass
	HashSpaceClass          = C.dHashSpaceClass
	SweepAndPruneSpaceClass = C.dSweepAndPruneSpaceClass
	QuadTreeSpaceClass      = C.dQuadTreeSpaceClass

	NumClasses = C.dGeomNumClasses

	MaxUserClasses = C.dMaxUserClasses
	FirstUserClass = C.dFirstUserClass
	LastUserClass  = C.dLastUserClass

	FirstSpaceClass = C.dFirstSpaceClass
	LastSpaceClass  = C.dLastSpaceClass
)

Geometry classes

View Source
const (
	BallJointType         = C.dJointTypeBall
	HingeJointType        = C.dJointTypeHinge
	SliderJointType       = C.dJointTypeSlider
	ContactJointType      = C.dJointTypeContact
	UniversalJointType    = C.dJointTypeUniversal
	Hinge2JointType       = C.dJointTypeHinge2
	FixedJointType        = C.dJointTypeFixed
	NullJointType         = C.dJointTypeNull
	AMotorJointType       = C.dJointTypeAMotor
	LMotorJointType       = C.dJointTypeLMotor
	Plane2DJointType      = C.dJointTypePlane2D
	PRJointType           = C.dJointTypePR
	PUJointType           = C.dJointTypePU
	PistonJointType       = C.dJointTypePiston
	DBallJointType        = C.dJointTypeDBall
	DHingeJointType       = C.dJointTypeDHinge
	TransmissionJointType = C.dJointTypeTransmission
)

Joint types

View Source
const (
	LoStopJtParam        = C.dParamLoStop
	HiStopJtParam        = C.dParamHiStop
	VelJtParam           = C.dParamVel
	LoVelJtParam         = C.dParamLoVel
	HiVelJtParam         = C.dParamHiVel
	FMaxJtParam          = C.dParamFMax
	FudgeFactorJtParam   = C.dParamFudgeFactor
	BounceJtParam        = C.dParamBounce
	CFMJtParam           = C.dParamCFM
	StopERPJtParam       = C.dParamStopERP
	StopCFMJtParam       = C.dParamStopCFM
	SuspensionERPJtParam = C.dParamSuspensionERP
	SuspensionCFMJtParam = C.dParamSuspensionCFM
	ERPJtParam           = C.dParamERP

	NumJtParams = C.dParamsInGroup

	JtParamGroup1         = C.dParamGroup1
	LoStopJtParam1        = C.dParamLoStop1
	HiStopJtParam1        = C.dParamHiStop1
	VelJtParam1           = C.dParamVel1
	LoVelJtParam1         = C.dParamLoVel1
	HiVelJtParam1         = C.dParamHiVel1
	FMaxJtParam1          = C.dParamFMax1
	FudgeFactorJtParam1   = C.dParamFudgeFactor1
	BounceJtParam1        = C.dParamBounce1
	CFMJtParam1           = C.dParamCFM1
	StopERPJtParam1       = C.dParamStopERP1
	StopCFMJtParam1       = C.dParamStopCFM1
	SuspensionERPJtParam1 = C.dParamSuspensionERP1
	SuspensionCFMJtParam1 = C.dParamSuspensionCFM1
	ERPJtParam1           = C.dParamERP1

	JtParamGroup2         = C.dParamGroup2
	LoStopJtParam2        = C.dParamLoStop2
	HiStopJtParam2        = C.dParamHiStop2
	VelJtParam2           = C.dParamVel2
	LoVelJtParam2         = C.dParamLoVel2
	HiVelJtParam2         = C.dParamHiVel2
	FMaxJtParam2          = C.dParamFMax2
	FudgeFactorJtParam2   = C.dParamFudgeFactor2
	BounceJtParam2        = C.dParamBounce2
	CFMJtParam2           = C.dParamCFM2
	StopERPJtParam2       = C.dParamStopERP2
	StopCFMJtParam2       = C.dParamStopCFM2
	SuspensionERPJtParam2 = C.dParamSuspensionERP2
	SuspensionCFMJtParam2 = C.dParamSuspensionCFM2
	ERPJtParam2           = C.dParamERP2

	JtParamGroup3         = C.dParamGroup3
	LoStopJtParam3        = C.dParamLoStop3
	HiStopJtParam3        = C.dParamHiStop3
	VelJtParam3           = C.dParamVel3
	LoVelJtParam3         = C.dParamLoVel3
	HiVelJtParam3         = C.dParamHiVel3
	FMaxJtParam3          = C.dParamFMax3
	FudgeFactorJtParam3   = C.dParamFudgeFactor3
	BounceJtParam3        = C.dParamBounce3
	CFMJtParam3           = C.dParamCFM3
	StopERPJtParam3       = C.dParamStopERP3
	StopCFMJtParam3       = C.dParamStopCFM3
	SuspensionERPJtParam3 = C.dParamSuspensionERP3
	SuspensionCFMJtParam3 = C.dParamSuspensionCFM3
	ERPJtParam3           = C.dParamERP3
)

Joint parameters

View Source
const (
	AMotorUser  = C.dAMotorUser
	AMotorEuler = C.dAMotorEuler
)

Angular motor parameters

View Source
const (
	TransmissionParallelAxes     = C.dTransmissionParallelAxes
	TransmissionIntersectingAxes = C.dTransmissionIntersectingAxes
	TransmissionChainDrive       = C.dTransmissionChainDrive
)

Transmission parameters

View Source
const (
	BasicDataAFlag     = C.dAllocateFlagBasicData
	CollisionDataAFlag = C.dAllocateFlagCollisionData
	AllAFlag           = C.dAllocateMaskAll
)

Allocation flags

View Source
const (
	SAPAxesXYZ = C.dSAP_AXES_XYZ
	SAPAxesXZY = C.dSAP_AXES_XZY
	SAPAxesYXZ = C.dSAP_AXES_YXZ
	SAPAxesYZX = C.dSAP_AXES_YZX
	SAPAxesZXY = C.dSAP_AXES_ZXY
	SAPAxesZYX = C.dSAP_AXES_ZYX
)

Sweep and prune axis orders

View Source
const (
	ManualThreadCleanupIFlag = C.dInitFlagManualThreadCleanup
)

Initialization flags

View Source
const (
	WorldStepThreadCountUnlimited = C.dWORLDSTEP_THREADCOUNT_UNLIMITED
)

World constants

Variables

Short constructor aliases for convenience

Functions

func CleanupAllDataForThread

func CleanupAllDataForThread()

CleanupAllDataForThread manually releases ODE resources for the current thread.

func Close

func Close()

Close releases ODE resources.

func Init

func Init(initFlags, allocFlags int)

Init initializes ODE.

Types

type AABB

type AABB Vector

AABB represents an axis-aligned bounding box.

func NewAABB

func NewAABB(vals ...float64) AABB

NewAABB returns a new AABB instance.

type AMotorJoint

type AMotorJoint struct {
	JointBase
}

AMotorJoint represents an angular motor joint.

func (AMotorJoint) AddTorques

func (j AMotorJoint) AddTorques(torque1, torque2, torque3 float64)

AddTorques adds torques to the joint.

func (AMotorJoint) Angle

func (j AMotorJoint) Angle(num int) float64

Angle returns the angle of the given axis.

func (AMotorJoint) AngleRate

func (j AMotorJoint) AngleRate(num int) float64

AngleRate returns the angle's rate of change for the given axis.

func (AMotorJoint) Axis

func (j AMotorJoint) Axis(num int) Vector3

Axis returns the given axis.

func (AMotorJoint) AxisRel

func (j AMotorJoint) AxisRel(num int) int

AxisRel returns the relative mode for the given axis.

func (AMotorJoint) Mode

func (j AMotorJoint) Mode() int

Mode returns the mode.

func (AMotorJoint) NumAxes

func (j AMotorJoint) NumAxes() int

NumAxes returns the number of axes.

func (AMotorJoint) Param

func (j AMotorJoint) Param(parameter int) float64

Param returns a joint parameter.

func (AMotorJoint) SetAngle

func (j AMotorJoint) SetAngle(num int, angle float64)

SetAngle sets the angle of the given axis.

func (AMotorJoint) SetAxis

func (j AMotorJoint) SetAxis(num, rel int, axis Vector3)

SetAxis sets the given axis relative to body rel (1 or 2) or none (0).

func (AMotorJoint) SetMode

func (j AMotorJoint) SetMode(mode int)

SetMode sets the mode.

func (AMotorJoint) SetNumAxes

func (j AMotorJoint) SetNumAxes(num int)

SetNumAxes sets the number of axes.

func (AMotorJoint) SetParam

func (j AMotorJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type BallJoint

type BallJoint struct {
	JointBase
}

BallJoint implements a ball-and-socket joint.

func (BallJoint) Anchor

func (j BallJoint) Anchor() Vector3

Anchor returns the anchor point for the first body.

func (BallJoint) Anchor2

func (j BallJoint) Anchor2() Vector3

Anchor2 returns the anchor point for the second body.

func (BallJoint) Param

func (j BallJoint) Param(parameter int) float64

Param returns a joint parameter.

func (BallJoint) SetAnchor

func (j BallJoint) SetAnchor(pt Vector3)

SetAnchor sets the anchor point for the first body.

func (BallJoint) SetAnchor2

func (j BallJoint) SetAnchor2(pt Vector3)

SetAnchor2 sets the anchor point for the second body.

func (BallJoint) SetParam

func (j BallJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type Body

type Body uintptr

Body represents a rigid body.

func (Body) AddForce

func (b Body) AddForce(force Vector3)

AddForce adds a force in world coordinates at the center of mass.

func (Body) AddForceAtPos

func (b Body) AddForceAtPos(force, pos Vector3)

AddForceAtPos adds a force in world coordinates at the position in world coordinates.

func (Body) AddForceAtRelPos

func (b Body) AddForceAtRelPos(force, pos Vector3)

AddForceAtRelPos adds a force in world coordinates at the position in body coordinates.

func (Body) AddRelForce

func (b Body) AddRelForce(force Vector3)

AddRelForce adds a force in body coordinates at the center of mass.

func (Body) AddRelForceAtPos

func (b Body) AddRelForceAtPos(force, pos Vector3)

AddRelForceAtPos adds a force in body coordinates at the position in world coordinates.

func (Body) AddRelForceAtRelPos

func (b Body) AddRelForceAtRelPos(force, pos Vector3)

AddRelForceAtRelPos adds a force in body coordinates at the position in body coordinates.

func (Body) AddRelTorque

func (b Body) AddRelTorque(torque Vector3)

AddRelTorque adds a torque in body coordinates at the center of mass.

func (Body) AddTorque

func (b Body) AddTorque(torque Vector3)

AddTorque adds a torque in world coordinates at the center of mass.

func (Body) AngularDamping

func (b Body) AngularDamping() float64

AngularDamping returns the angular damping scale.

func (Body) AngularDampingThreshold

func (b Body) AngularDampingThreshold() float64

AngularDampingThreshold returns the angular damping threshold.

func (Body) AngularVel

func (b Body) AngularVel() Vector3

AngularVel returns the angular velocity.

func (Body) AutoDisable

func (b Body) AutoDisable() bool

AutoDisable returns whether the body will be auto disabled.

func (Body) AutoDisableAngularThreshold

func (b Body) AutoDisableAngularThreshold() float64

AutoDisableAngularThreshold returns the auto disable angular average threshold.

func (Body) AutoDisableAverageSamplesCount

func (b Body) AutoDisableAverageSamplesCount() int

AutoDisableAverageSamplesCount returns the auto disable sample count.

func (Body) AutoDisableLinearThreshold

func (b Body) AutoDisableLinearThreshold() float64

AutoDisableLinearThreshold returns the auto disable linear average threshold.

func (Body) AutoDisableSteps

func (b Body) AutoDisableSteps() int

AutoDisableSteps returns the number of auto disable steps.

func (Body) AutoDisableTime

func (b Body) AutoDisableTime() float64

AutoDisableTime returns the auto disable time.

func (Body) Connected

func (b Body) Connected(other Body) bool

Connected returns whether the body is connected to the given body by a joint.

func (Body) ConnectedExcluding

func (b Body) ConnectedExcluding(other Body, jointType int) bool

ConnectedExcluding returns whether the body is connected to the given body by a joint, except for joints of the given class.

func (Body) ConnectingJoint

func (b Body) ConnectingJoint(other Body) Joint

ConnectingJoint returns the first joint connecting the body to the specified body.

func (Body) ConnectingJointList

func (b Body) ConnectingJointList(other Body) []Joint

ConnectingJointList returns a list of joints connecting the body to the specified body.

func (Body) Data

func (b Body) Data() interface{}

Data returns the user-specified data associated with the body.

func (Body) Destroy

func (b Body) Destroy()

Destroy destroys the body.

func (Body) Enabled

func (b Body) Enabled() bool

Enabled returns whether the body is enabled.

func (Body) FiniteRotationAxis

func (b Body) FiniteRotationAxis() Vector3

FiniteRotationAxis returns the finite rotation axis.

func (Body) FiniteRotationMode

func (b Body) FiniteRotationMode() bool

FiniteRotationMode returns whether finite rotation mode is used.

func (Body) FirstGeom

func (b Body) FirstGeom() Geom

FirstGeom returns the first geometry associated with the body.

func (Body) Force

func (b Body) Force() Vector3

Force returns the force acting on the center of mass.

func (Body) GravityEnabled

func (b Body) GravityEnabled() bool

GravityEnabled returns whether gravity affects the body.

func (Body) GyroModeEnabled

func (b Body) GyroModeEnabled() bool

GyroModeEnabled returns whether gyroscopic mode is enabled.

func (Body) Joint

func (b Body) Joint(index int) Joint

Joint returns the joint attached to the body, specified by index.

func (Body) Kinematic

func (b Body) Kinematic() bool

Kinematic returns whether the body is in kinematic mode.

func (Body) LinearDamping

func (b Body) LinearDamping() float64

LinearDamping returns the linear damping scale.

func (Body) LinearDampingThreshold

func (b Body) LinearDampingThreshold() float64

LinearDampingThreshold returns the linear damping threshold.

func (Body) LinearVelocity

func (b Body) LinearVelocity() Vector3

LinearVelocity returns the linear velocity.

func (Body) Mass

func (b Body) Mass() *Mass

Mass returns the mass.

func (Body) MaxAngularSpeed

func (b Body) MaxAngularSpeed() float64

MaxAngularSpeed returns the maximum angular speed.

func (Body) NumJoints

func (b Body) NumJoints() int

NumJoints returns the number of joints attached to the body.

func (Body) PointVel

func (b Body) PointVel(pt Vector3) Vector3

PointVel returns the velocity in world coordinates of a point in world coordinates.

func (Body) PosRelPoint

func (b Body) PosRelPoint(pos Vector3) Vector3

PosRelPoint returns the position in body coordinates of a point in world coordinates.

func (Body) Position

func (b Body) Position() Vector3

Position returns the position.

func (Body) Quaternion

func (b Body) Quaternion() Quaternion

Quaternion returns the orientation represented by a quaternion.

func (Body) RelPointPos

func (b Body) RelPointPos(pt Vector3) Vector3

RelPointPos returns the position in world coordinates of a point in body coordinates.

func (Body) RelPointVel

func (b Body) RelPointVel(pt Vector3) Vector3

RelPointVel returns the velocity in world coordinates of a point in body coordinates.

func (Body) Rotation

func (b Body) Rotation() Matrix3

Rotation returns the orientation represented by a rotation matrix.

func (Body) SetAngularDamping

func (b Body) SetAngularDamping(scale float64)

SetAngularDamping sets the angular damping scale.

func (Body) SetAngularDampingThreshold

func (b Body) SetAngularDampingThreshold(threshold float64)

SetAngularDampingThreshold sets the angular damping threshold.

func (Body) SetAngularVelocity

func (b Body) SetAngularVelocity(vel Vector3)

SetAngularVelocity sets the angular velocity.

func (Body) SetAutoAutoDisableAverageSamplesCount

func (b Body) SetAutoAutoDisableAverageSamplesCount(count int)

SetAutoAutoDisableAverageSamplesCount sets auto disable average sample count.

func (Body) SetAutoDisable

func (b Body) SetAutoDisable(doAutoDisable bool)

SetAutoDisable sets wether the body will be auto disabled.

func (Body) SetAutoDisableAngularThreshold

func (b Body) SetAutoDisableAngularThreshold(thresh float64)

SetAutoDisableAngularThreshold sets the auto disable angular average threshold.

func (Body) SetAutoDisableDefaults

func (b Body) SetAutoDisableDefaults()

SetAutoDisableDefaults sets auto disable settings to default defaults.

func (Body) SetAutoDisableLinearThreshold

func (b Body) SetAutoDisableLinearThreshold(thresh float64)

SetAutoDisableLinearThreshold sets the auto disable linear average threshold.

func (Body) SetAutoDisableSteps

func (b Body) SetAutoDisableSteps(steps int)

SetAutoDisableSteps sets the number of auto disable steps.

func (Body) SetAutoDisableTime

func (b Body) SetAutoDisableTime(time float64)

SetAutoDisableTime sets the auto disable time.

func (Body) SetDampingDefaults

func (b Body) SetDampingDefaults()

SetDampingDefaults sets damping settings to default values.

func (Body) SetData

func (b Body) SetData(data interface{})

SetData associates user-specified data with the body.

func (Body) SetEnabled

func (b Body) SetEnabled(isEnabled bool)

SetEnabled sets whether the body is enabled.

func (Body) SetFiniteRotationAxis

func (b Body) SetFiniteRotationAxis(axis Vector3)

SetFiniteRotationAxis sets the finite rotation axis.

func (Body) SetFiniteRotationMode

func (b Body) SetFiniteRotationMode(isFinite bool)

SetFiniteRotationMode sets whether finite rotation mode is used.

func (Body) SetForce

func (b Body) SetForce(force Vector3)

SetForce sets the force acting on the center of mass.

func (Body) SetGravityEnabled

func (b Body) SetGravityEnabled(isGravityEnabled bool)

SetGravityEnabled sets whether gravity affects the body.

func (Body) SetGyroModeEnabled

func (b Body) SetGyroModeEnabled(isEnabled bool)

SetGyroModeEnabled sets whether gyroscopic mode is enabled.

func (Body) SetKinematic

func (b Body) SetKinematic(isKinematic bool)

SetKinematic sets whether the body is in kinematic mode.

func (Body) SetLinearDamping

func (b Body) SetLinearDamping(scale float64)

SetLinearDamping sets the linear damping scale.

func (Body) SetLinearDampingThreshold

func (b Body) SetLinearDampingThreshold(threshold float64)

SetLinearDampingThreshold sets the linear damping threshold.

func (Body) SetLinearVelocity

func (b Body) SetLinearVelocity(vel Vector3)

SetLinearVelocity sets the linear velocity.

func (Body) SetMass

func (b Body) SetMass(mass *Mass)

SetMass sets the mass.

func (Body) SetMaxAngularSpeed

func (b Body) SetMaxAngularSpeed(maxSpeed float64)

SetMaxAngularSpeed sets the maximum angular speed.

func (Body) SetMovedCallback

func (b Body) SetMovedCallback(cb MovedCallback)

SetMovedCallback sets callback to call when the body has moved.

func (Body) SetPosition

func (b Body) SetPosition(pos Vector3)

SetPosition sets the position.

func (Body) SetQuaternion

func (b Body) SetQuaternion(quat Quaternion)

SetQuaternion sets the orientation represented by a quaternion.

func (Body) SetRotation

func (b Body) SetRotation(rot Matrix3)

SetRotation sets the orientation represented by a rotation matrix.

func (Body) SetTorque

func (b Body) SetTorque(torque Vector3)

SetTorque sets the torque acting on the center of mass.

func (Body) Torque

func (b Body) Torque() Vector3

Torque returns the torque acting on the center of mass.

func (Body) VectorFromWorld

func (b Body) VectorFromWorld(wld Vector3) Vector3

VectorFromWorld converts a vector in world coordinates to body coordinates.

func (Body) VectorToWorld

func (b Body) VectorToWorld(vec Vector3) Vector3

VectorToWorld converts a vector in body coordinates to world coordinates.

func (Body) World

func (b Body) World() World

World returns the world which contains the body.

type Box

type Box struct {
	GeomBase
}

Box is a geometry representing a rectangular box.

func (Box) Lengths

func (b Box) Lengths() Vector3

Lengths returns the lengths of the sides.

func (Box) PointDepth

func (b Box) PointDepth(pt Vector3) float64

PointDepth returns the depth of the given point.

func (Box) SetLengths

func (b Box) SetLengths(lens Vector3)

SetLengths sets the lengths of the sides.

type Capsule

type Capsule struct {
	GeomBase
}

Capsule is a geometry that represents a capsule (a cylinder with a half sphere on each end).

func (Capsule) Params

func (c Capsule) Params() (float64, float64)

Params returns the radius and length.

func (Capsule) PointDepth

func (c Capsule) PointDepth(pt Vector3) float64

PointDepth returns the depth of the given point.

func (Capsule) SetParams

func (c Capsule) SetParams(radius, length float64)

SetParams sets the radius and length.

type Contact

type Contact struct {
	Surface SurfaceParameters
	Geom    ContactGeom
	FDir1   Vector3
}

Contact represents a contact.

func NewContact

func NewContact() *Contact

NewContact returns a new Contact.

type ContactGeom

type ContactGeom struct {
	Pos    Vector3
	Normal Vector3
	Depth  float64
	G1     Geom
	G2     Geom
	Side1  int
	Side2  int
}

ContactGeom represents a contact point.

func NewContactGeom

func NewContactGeom() *ContactGeom

NewContactGeom returns a new ContactGeom.

type ContactJoint

type ContactJoint struct {
	JointBase
}

ContactJoint represents a contact joint.

type Convex

type Convex struct {
	GeomBase
}

Convex is a geometry representing a convex object.

func (Convex) Set

func (c Convex) Set(planes PlaneList, pts VertexList, polyList PolygonList)

Set sets convex object data

type Cylinder

type Cylinder struct {
	GeomBase
}

Cylinder is a geometry that represents a cylider.

func (Cylinder) Params

func (c Cylinder) Params() (float64, float64)

Params returns the radius and length.

func (Cylinder) SetParams

func (c Cylinder) SetParams(radius, length float64)

SetParams sets the radius and length.

type DBallJoint

type DBallJoint struct {
	JointBase
}

DBallJoint represents a double ball joint.

func (DBallJoint) Anchor1

func (j DBallJoint) Anchor1() Vector3

Anchor1 returns the anchor point for the first body.

func (DBallJoint) Anchor2

func (j DBallJoint) Anchor2() Vector3

Anchor2 returns the anchor point for the second body.

func (DBallJoint) Distance

func (j DBallJoint) Distance() float64

Distance returns the joint distance.

func (DBallJoint) Param

func (j DBallJoint) Param(parameter int) float64

Param returns a joint parameter.

func (DBallJoint) SetAnchor1

func (j DBallJoint) SetAnchor1(pt Vector3)

SetAnchor1 sets the anchor point for the first body.

func (DBallJoint) SetAnchor2

func (j DBallJoint) SetAnchor2(pt Vector3)

SetAnchor2 sets the anchor point for the second body.

func (DBallJoint) SetParam

func (j DBallJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type DHingeJoint

type DHingeJoint struct {
	JointBase
}

DHingeJoint represents a double hinge joint.

func (DHingeJoint) Anchor1

func (j DHingeJoint) Anchor1() Vector3

Anchor1 returns the anchor point for the first body.

func (DHingeJoint) Anchor2

func (j DHingeJoint) Anchor2() Vector3

Anchor2 returns the anchor point for the second body.

func (DHingeJoint) Axis

func (j DHingeJoint) Axis() Vector3

Axis returns the joint axis.

func (DHingeJoint) Distance

func (j DHingeJoint) Distance() float64

Distance returns the joint distance.

func (DHingeJoint) Param

func (j DHingeJoint) Param(parameter int) float64

Param returns a joint parameter.

func (DHingeJoint) SetAnchor1

func (j DHingeJoint) SetAnchor1(pt Vector3)

SetAnchor1 sets the anchor point for the first body.

func (DHingeJoint) SetAnchor2

func (j DHingeJoint) SetAnchor2(pt Vector3)

SetAnchor2 sets the anchor point for the second body.

func (DHingeJoint) SetAxis

func (j DHingeJoint) SetAxis(axis Vector3)

SetAxis sets the joint axis.

func (DHingeJoint) SetParam

func (j DHingeJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type FixedJoint

type FixedJoint struct {
	JointBase
}

FixedJoint represents a fixed joint.

func (FixedJoint) Fix

func (j FixedJoint) Fix()

Fix fixes the joint in its current state.

func (FixedJoint) Param

func (j FixedJoint) Param(parameter int) float64

Param returns a joint parameter.

func (FixedJoint) SetParam

func (j FixedJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type Geom

type Geom interface {
	Destroy()
	SetData(data interface{})
	Data() interface{}
	SetBody(body Body)
	Body() Body
	SetPosition(pos Vector3)
	Position() Vector3
	SetRotation(rot Matrix3)
	Rotation() Matrix3
	SetQuaternion(quat Quaternion)
	Quaternion() Quaternion
	AABB() AABB
	IsSpace() bool
	Space() Space
	Class() int
	SetCategoryBits(bits int)
	SetCollideBits(bits int)
	CategoryBits() int
	CollideBits() int
	SetEnabled(isEnabled bool)
	Enabled() bool
	RelPointPos(pt Vector3) Vector3
	PosRelPoint(pos Vector3) Vector3
	VectorToWorld(vec Vector3) Vector3
	VectorFromWorld(wld Vector3) Vector3
	OffsetPosition() Vector3
	SetOffsetPosition(pos Vector3)
	OffsetRotation() Matrix3
	SetOffsetRotation(rot Matrix3)
	OffsetQuaternion() Quaternion
	SetOffsetQuaternion(quat Quaternion)
	SetOffsetWorldPosition(pos Vector3)
	SetOffsetWorldRotation(rot Matrix3)
	SetOffsetWorldQuaternion(quat Quaternion)
	ClearOffset()
	IsOffset() bool
	Collide(other Geom, maxContacts uint16, flags int) []ContactGeom
	Collide2(other Geom, data interface{}, cb NearCallback)
	Next() Geom
	// contains filtered or unexported methods
}

Geom represents rigid body geometry.

type GeomBase

type GeomBase uintptr

GeomBase implements Geom, and is embedded by specific Geom types.

func (GeomBase) AABB

func (g GeomBase) AABB() AABB

AABB returns the axis-aligned bounding box.

func (GeomBase) Body

func (g GeomBase) Body() Body

Body returns the body associated with the geometry.

func (GeomBase) CategoryBits

func (g GeomBase) CategoryBits() int

CategoryBits returns the category bitfield.

func (GeomBase) Class

func (g GeomBase) Class() int

Class returns the geometry class.

func (GeomBase) ClearOffset

func (g GeomBase) ClearOffset()

ClearOffset removes the body offset.

func (GeomBase) Collide

func (g GeomBase) Collide(other Geom, maxContacts uint16, flags int) []ContactGeom

Collide tests for collision with the given geometry and returns a list of contact points.

func (GeomBase) Collide2

func (g GeomBase) Collide2(other Geom, data interface{}, cb NearCallback)

Collide2 tests for collision with the given geometry, applying cb for each contact.

func (GeomBase) CollideBits

func (g GeomBase) CollideBits() int

CollideBits returns the collide bitfield.

func (GeomBase) Data

func (g GeomBase) Data() interface{}

Data returns the user-specified data associated with the geometry.

func (GeomBase) Destroy

func (g GeomBase) Destroy()

Destroy destroys the GeomBase.

func (GeomBase) Enabled

func (g GeomBase) Enabled() bool

Enabled returns whether the geometry is enabled.

func (GeomBase) IsOffset

func (g GeomBase) IsOffset() bool

IsOffset returns whether a body offset has been created.

func (GeomBase) IsSpace

func (g GeomBase) IsSpace() bool

IsSpace returns whether the geometry is a space.

func (GeomBase) Next

func (g GeomBase) Next() Geom

Next returns the next geometry.

func (GeomBase) OffsetPosition

func (g GeomBase) OffsetPosition() Vector3

OffsetPosition returns the position offset from the body.

func (GeomBase) OffsetQuaternion

func (g GeomBase) OffsetQuaternion() Quaternion

OffsetQuaternion returns the orientation offset from the body represented by a quaternion.

func (GeomBase) OffsetRotation

func (g GeomBase) OffsetRotation() Matrix3

OffsetRotation returns the orientation offset from the body represented by a rotation matrix.

func (GeomBase) PosRelPoint

func (g GeomBase) PosRelPoint(pos Vector3) Vector3

PosRelPoint returns the position in geometry coordinates of a point in world coordinates.

func (GeomBase) Position

func (g GeomBase) Position() Vector3

Position returns the position.

func (GeomBase) Quaternion

func (g GeomBase) Quaternion() Quaternion

Quaternion returns the orientation represented by a quaternion.

func (GeomBase) RelPointPos

func (g GeomBase) RelPointPos(pt Vector3) Vector3

RelPointPos returns the position in world coordinates of a point in geometry coordinates.

func (GeomBase) Rotation

func (g GeomBase) Rotation() Matrix3

Rotation returns the orientation represented by a rotation matrix.

func (GeomBase) SetBody

func (g GeomBase) SetBody(body Body)

SetBody sets the associated body.

func (GeomBase) SetCategoryBits

func (g GeomBase) SetCategoryBits(bits int)

SetCategoryBits sets the category bitfield.

func (GeomBase) SetCollideBits

func (g GeomBase) SetCollideBits(bits int)

SetCollideBits sets the collide bitfield.

func (GeomBase) SetData

func (g GeomBase) SetData(data interface{})

SetData associates user-specified data with the geometry.

func (GeomBase) SetEnabled

func (g GeomBase) SetEnabled(isEnabled bool)

SetEnabled sets whether the geometry is enabled.

func (GeomBase) SetOffsetPosition

func (g GeomBase) SetOffsetPosition(pos Vector3)

SetOffsetPosition sets the position offset from the body.

func (GeomBase) SetOffsetQuaternion

func (g GeomBase) SetOffsetQuaternion(quat Quaternion)

SetOffsetQuaternion sets the offset from the body orientation represented by a quaternion.

func (GeomBase) SetOffsetRotation

func (g GeomBase) SetOffsetRotation(rot Matrix3)

SetOffsetRotation sets the orientation offset from the body represented by a rotation matrix.

func (GeomBase) SetOffsetWorldPosition

func (g GeomBase) SetOffsetWorldPosition(pos Vector3)

SetOffsetWorldPosition sets the offset to the body position such that the geom's world position is pos.

func (GeomBase) SetOffsetWorldQuaternion

func (g GeomBase) SetOffsetWorldQuaternion(quat Quaternion)

SetOffsetWorldQuaternion sets the offset to the body orientation such that the geom's world orientation is represented by the quaternion quat.

func (GeomBase) SetOffsetWorldRotation

func (g GeomBase) SetOffsetWorldRotation(rot Matrix3)

SetOffsetWorldRotation sets the offset to the body orientation such that the geom's world orientation is represented by the matrix rot.

func (GeomBase) SetPosition

func (g GeomBase) SetPosition(pos Vector3)

SetPosition sets the position.

func (GeomBase) SetQuaternion

func (g GeomBase) SetQuaternion(quat Quaternion)

SetQuaternion sets the orientation represented by a quaternion.

func (GeomBase) SetRotation

func (g GeomBase) SetRotation(rot Matrix3)

SetRotation sets the orientation represented by a rotation matrix.

func (GeomBase) Space

func (g GeomBase) Space() Space

Space returns the containing space.

func (GeomBase) VectorFromWorld

func (g GeomBase) VectorFromWorld(wld Vector3) Vector3

VectorFromWorld converts a vector in world coordinates to geometry coordinates.

func (GeomBase) VectorToWorld

func (g GeomBase) VectorToWorld(vec Vector3) Vector3

VectorToWorld converts a vector in geometry coordinates to world coordinates.

type HashSpace

type HashSpace struct {
	SpaceBase
}

HashSpace represents a hash space.

func (HashSpace) Levels

func (s HashSpace) Levels() (int, int)

Levels returns the minimum and maximum levels.

func (HashSpace) SetLevels

func (s HashSpace) SetLevels(min, max int)

SetLevels sets the minimum and maximum levels.

type Heightfield

type Heightfield struct {
	GeomBase
}

Heightfield is a geometry representing a heightfield.

func (Heightfield) Build

func (h Heightfield) Build(data HeightfieldData, heightSamples Matrix,
	width, depth, scale, offset, thickness float64, doWrap bool)

Build builds a heightfield data set.

func (Heightfield) HeightfieldData

func (h Heightfield) HeightfieldData() HeightfieldData

HeightfieldData returns the data set associated with the heightfield.

func (Heightfield) SetBounds

func (h Heightfield) SetBounds(data HeightfieldData, minHeight, maxHeight float64)

SetBounds sets the minimum and maximum height.

func (Heightfield) SetHeightfieldData

func (h Heightfield) SetHeightfieldData(data HeightfieldData)

SetHeightfieldData associates a data set to the heightfield.

type HeightfieldData

type HeightfieldData uintptr

HeightfieldData represents heightfield data.

func NewHeightfieldData

func NewHeightfieldData() HeightfieldData

NewHeightfieldData returns a new HeightfieldData instance.

func (*HeightfieldData) Destroy

func (h *HeightfieldData) Destroy()

Destroy destroys the heightfield data.

type Hinge2Joint

type Hinge2Joint struct {
	JointBase
}

Hinge2Joint represents two hinge joints in series.

func (Hinge2Joint) AddTorques

func (j Hinge2Joint) AddTorques(torque1, torque2 float64)

AddTorques adds torques to the joint.

func (Hinge2Joint) Anchor

func (j Hinge2Joint) Anchor() Vector3

Anchor returns the anchor point for the first body.

func (Hinge2Joint) Anchor2

func (j Hinge2Joint) Anchor2() Vector3

Anchor2 returns the anchor point for the second body.

func (Hinge2Joint) Angle1

func (j Hinge2Joint) Angle1() float64

Angle1 returns the first angle.

func (Hinge2Joint) Angle1Rate

func (j Hinge2Joint) Angle1Rate() float64

Angle1Rate returns the first angle's rate of change.

func (Hinge2Joint) Angle2

func (j Hinge2Joint) Angle2() float64

Angle2 returns the second angle.

func (Hinge2Joint) Angle2Rate

func (j Hinge2Joint) Angle2Rate() float64

Angle2Rate returns the second angle's rate of change.

func (Hinge2Joint) Axis1

func (j Hinge2Joint) Axis1() Vector3

Axis1 returns the first axis.

func (Hinge2Joint) Axis2

func (j Hinge2Joint) Axis2() Vector3

Axis2 returns the second axis.

func (Hinge2Joint) Param

func (j Hinge2Joint) Param(parameter int) float64

Param returns a joint parameter.

func (Hinge2Joint) SetAnchor

func (j Hinge2Joint) SetAnchor(pt Vector3)

SetAnchor sets the anchor point.

func (Hinge2Joint) SetAxis1

func (j Hinge2Joint) SetAxis1(axis Vector3)

SetAxis1 sets the first axis.

func (Hinge2Joint) SetAxis2

func (j Hinge2Joint) SetAxis2(axis Vector3)

SetAxis2 sets the second axis.

func (Hinge2Joint) SetParam

func (j Hinge2Joint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type HingeJoint

type HingeJoint struct {
	JointBase
}

HingeJoint represents a hinge joint.

func (HingeJoint) AddTorque

func (j HingeJoint) AddTorque(torque float64)

AddTorque adds a torque to the joint.

func (HingeJoint) Anchor

func (j HingeJoint) Anchor() Vector3

Anchor returns the anchor point for the first body.

func (HingeJoint) Anchor2

func (j HingeJoint) Anchor2() Vector3

Anchor2 returns the anchor point for the second body.

func (HingeJoint) Angle

func (j HingeJoint) Angle() float64

Angle returns the joint angle.

func (HingeJoint) AngleRate

func (j HingeJoint) AngleRate() float64

AngleRate returns the joint angle's rate of change.

func (HingeJoint) Axis

func (j HingeJoint) Axis() Vector3

Axis returns the hinge axis.

func (HingeJoint) Param

func (j HingeJoint) Param(parameter int) float64

Param returns a joint parameter.

func (HingeJoint) SetAnchor

func (j HingeJoint) SetAnchor(pt Vector3)

SetAnchor sets the anchor point.

func (HingeJoint) SetAnchorDelta

func (j HingeJoint) SetAnchorDelta(pt, delta Vector3)

SetAnchorDelta sets the hinge anchor delta.

func (HingeJoint) SetAxis

func (j HingeJoint) SetAxis(axis Vector3)

SetAxis sets the hinge axis.

func (HingeJoint) SetAxisOffset

func (j HingeJoint) SetAxisOffset(axis Vector3, angle float64)

SetAxisOffset set the hinge axis as if the 2 bodies were already at angle appart.

func (HingeJoint) SetParam

func (j HingeJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type Joint

type Joint interface {
	Destroy()
	SetData(data interface{})
	Data() interface{}
	NumBodies() int
	Attach(body1, body2 Body)
	SetEnabled(isEnabled bool)
	Enabled() bool
	Type() int
	Body(index int) Body
	SetFeedback(f *JointFeedback)
	Feedback() *JointFeedback
	// contains filtered or unexported methods
}

Joint represents a joint.

type JointBase

type JointBase uintptr

JointBase implements Joint, and is embedded by specific Joint types.

func (JointBase) Attach

func (j JointBase) Attach(body1, body2 Body)

Attach attaches two bodies with the joint.

func (JointBase) Body

func (j JointBase) Body(index int) Body

Body returns the attached body, specified by index.

func (JointBase) Data

func (j JointBase) Data() interface{}

Data returns the user-specified data associated with the joint.

func (JointBase) Destroy

func (j JointBase) Destroy()

Destroy destroys the joint base.

func (JointBase) Enabled

func (j JointBase) Enabled() bool

Enabled returns whether the joint is enabled.

func (JointBase) Feedback

func (j JointBase) Feedback() *JointFeedback

Feedback returns the feedback forces and torques.

func (JointBase) NumBodies

func (j JointBase) NumBodies() int

NumBodies returns the number of attached bodies.

func (JointBase) SetData

func (j JointBase) SetData(data interface{})

SetData associates user-specified data with the joint.

func (JointBase) SetEnabled

func (j JointBase) SetEnabled(isEnabled bool)

SetEnabled sets whether the joint is enabled.

func (JointBase) SetFeedback

func (j JointBase) SetFeedback(f *JointFeedback)

SetFeedback sets the feedback forces and torques.

func (JointBase) Type

func (j JointBase) Type() int

Type returns the joint type.

type JointFeedback

type JointFeedback struct {
	Force1  Vector3 // force applied to body 1
	Torque1 Vector3 // torque applied to body 1
	Force2  Vector3 // force applied to body 2
	Torque2 Vector3 // torque applied to body 2
}

JointFeedback represents feedback forces and torques associated with a joint.

type JointGroup

type JointGroup uintptr

JointGroup represents a group of joints.

func NewJointGroup

func NewJointGroup(maxJoints int) JointGroup

NewJointGroup returns a new JointGroup instance.

func (JointGroup) Destroy

func (g JointGroup) Destroy()

Destroy destroys the joint group.

func (JointGroup) Empty

func (g JointGroup) Empty()

Empty removes all joints from the group.

type LMotorJoint

type LMotorJoint struct {
	JointBase
}

LMotorJoint represents a linear motor joint.

func (LMotorJoint) Axis

func (j LMotorJoint) Axis(num int) Vector3

Axis returns the given axis.

func (LMotorJoint) NumAxes

func (j LMotorJoint) NumAxes() int

NumAxes returns the number of axes.

func (LMotorJoint) Param

func (j LMotorJoint) Param(parameter int) float64

Param returns a joint parameter.

func (LMotorJoint) SetAxis

func (j LMotorJoint) SetAxis(num, rel int, axis Vector3)

SetAxis sets the given axis relative to a body (1 or 2) or none (0).

func (LMotorJoint) SetNumAxes

func (j LMotorJoint) SetNumAxes(num int)

SetNumAxes sets the number of axes.

func (LMotorJoint) SetParam

func (j LMotorJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type Mass

type Mass struct {
	Center  Vector3
	Inertia Matrix3
	Mass    float64
}

Mass represents object mass properties.

func NewMass

func NewMass() *Mass

NewMass returns a new Mass instance.

func (*Mass) Add

func (m *Mass) Add(other *Mass)

Add adds the other mass to this mass.

func (*Mass) Adjust

func (m *Mass) Adjust(mass float64)

Adjust sets parameters based on the given total mass.

func (*Mass) Check

func (m *Mass) Check() bool

Check returns whether the mass's parameter values are valid.

func (*Mass) Rotate

func (m *Mass) Rotate(rot Matrix3)

Rotate rotates the mass by rot.

func (*Mass) SetBox

func (m *Mass) SetBox(density float64, lens Vector3)

SetBox sets the mass for a box of given properties.

func (*Mass) SetBoxTotal

func (m *Mass) SetBoxTotal(totalMass float64, lens Vector3)

SetBoxTotal sets the mass for a box of given properties.

func (*Mass) SetCapsule

func (m *Mass) SetCapsule(density float64, direction int, radius, length float64)

SetCapsule sets the mass for a capsule of given properties.

func (*Mass) SetCapsuleTotal

func (m *Mass) SetCapsuleTotal(totalMass float64, direction int, radius, length float64)

SetCapsuleTotal sets the mass for a capsule of given properties.

func (*Mass) SetCylinder

func (m *Mass) SetCylinder(density float64, direction int, radius, length float64)

SetCylinder sets the mass for a cylinder of given properties.

func (*Mass) SetCylinderTotal

func (m *Mass) SetCylinderTotal(totalMass float64, direction int, radius, length float64)

SetCylinderTotal sets the mass for a cylinder of given properties.

func (*Mass) SetParams

func (m *Mass) SetParams(mass float64, com Vector3, inert Matrix3)

SetParams sets the mass parameters.

func (*Mass) SetSphere

func (m *Mass) SetSphere(density, radius float64)

SetSphere sets the mass for a sphere of given properties.

func (*Mass) SetSphereTotal

func (m *Mass) SetSphereTotal(totalMass, radius float64)

SetSphereTotal sets the mass for a sphere of given properties.

func (*Mass) SetTriMesh

func (m *Mass) SetTriMesh(density float64, mesh TriMesh)

SetTrimesh sets the mass for the given triangle mesh.

func (*Mass) SetTriMeshTotal

func (m *Mass) SetTriMeshTotal(totalMass float64, mesh TriMesh)

SetTrimeshTotal sets the mass for the given triangle mesh.

func (*Mass) SetZero

func (m *Mass) SetZero()

SetZero sets the mass to 0.

func (*Mass) Translate

func (m *Mass) Translate(vec Vector3)

Translate translates the mass by vec.

type Matrix

type Matrix [][]float64

Matrix represents a double precision matrix.

func NewMatrix

func NewMatrix(numRows, numCols, align int, vals ...float64) Matrix

NewVector returns a new Matrix instance.

type Matrix3

type Matrix3 Matrix

Matrix3 represents a 3x3 matrix.

func NewMatrix3

func NewMatrix3(vals ...float64) Matrix3

NewMatrix3 returns a new Matrix3 instance.

type Matrix4

type Matrix4 Matrix

Matrix4 represents a 4x4 matrix.

func NewMatrix4

func NewMatrix4(vals ...float64) Matrix4

NewMatrix4 returns a new Matrix4 instance.

type MovedCallback

type MovedCallback func(b Body)

MovedCallback is called when the body has moved.

type NearCallback

type NearCallback func(data interface{}, obj1, obj2 Geom)

NearCallback is a callback type for handling potential object collisions.

type NullJoint

type NullJoint struct {
	JointBase
}

NullJoint represents a null joint.

type PRJoint

type PRJoint struct {
	JointBase
}

PRJoint represents a prismatic rotoide joint.

func (PRJoint) AddTorque

func (j PRJoint) AddTorque(torque float64)

AddTorque adds a torque to the joint.

func (PRJoint) Anchor

func (j PRJoint) Anchor() Vector3

Anchor returns the anchor point.

func (PRJoint) Angle

func (j PRJoint) Angle() float64

Angle returns the joint angle.

func (PRJoint) AngleRate

func (j PRJoint) AngleRate() float64

AngleRate returns the joint angle's rate of change.

func (PRJoint) Axis1

func (j PRJoint) Axis1() Vector3

Axis1 returns the first axis.

func (PRJoint) Axis2

func (j PRJoint) Axis2() Vector3

Axis2 returns the second axis.

func (PRJoint) Param

func (j PRJoint) Param(parameter int) float64

Param returns a joint parameter.

func (PRJoint) Position

func (j PRJoint) Position() float64

Position returns the slider position.

func (PRJoint) PositionRate

func (j PRJoint) PositionRate() float64

PositionRate returns the slider position's rate of change.

func (PRJoint) SetAnchor

func (j PRJoint) SetAnchor(pt Vector3)

SetAnchor sets the anchor point.

func (PRJoint) SetAxis1

func (j PRJoint) SetAxis1(axis Vector3)

SetAxis1 sets the first axis.

func (PRJoint) SetAxis2

func (j PRJoint) SetAxis2(axis Vector3)

SetAxis2 sets the second axis.

func (PRJoint) SetParam

func (j PRJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type PUJoint

type PUJoint struct {
	JointBase
}

PUJoint represents a prismatic universal joint.

func (PUJoint) Anchor

func (j PUJoint) Anchor() Vector3

Anchor returns the anchor point.

func (PUJoint) Angle1

func (j PUJoint) Angle1() float64

Angle1 returns the first angle.

func (PUJoint) Angle1Rate

func (j PUJoint) Angle1Rate() float64

Angle1Rate returns the first angle's rate of change.

func (PUJoint) Angle2

func (j PUJoint) Angle2() float64

Angle2 returns the second angle.

func (PUJoint) Angle2Rate

func (j PUJoint) Angle2Rate() float64

Angle2Rate returns the second angle's rate of change.

func (PUJoint) Angles

func (j PUJoint) Angles() (float64, float64)

Angles returns the two joint angles.

func (PUJoint) Axis1

func (j PUJoint) Axis1() Vector3

Axis1 returns the first axis.

func (PUJoint) Axis2

func (j PUJoint) Axis2() Vector3

Axis2 returns the second axis.

func (PUJoint) Axis3

func (j PUJoint) Axis3() Vector3

Axis3 returns the third (prismatic) axis.

func (PUJoint) Param

func (j PUJoint) Param(parameter int) float64

Param returns a joint parameter.

func (PUJoint) Position

func (j PUJoint) Position() float64

Position returns the joint position.

func (PUJoint) PositionRate

func (j PUJoint) PositionRate() float64

PositionRate returns the joint position's rate of change.

func (PUJoint) SetAnchor

func (j PUJoint) SetAnchor(pt Vector3)

SetAnchor sets the anchor point.

func (PUJoint) SetAnchorOffset

func (j PUJoint) SetAnchorOffset(pt, delta Vector3)

SetAnchorOffset sets the anchor as if the 2 bodies were already delta appart.

func (PUJoint) SetAxis1

func (j PUJoint) SetAxis1(axis Vector3)

SetAxis1 sets the first axis.

func (PUJoint) SetAxis2

func (j PUJoint) SetAxis2(axis Vector3)

SetAxis2 sets the second axis.

func (PUJoint) SetAxis3

func (j PUJoint) SetAxis3(axis Vector3)

SetAxis3 sets the third (prismatic) axis.

func (PUJoint) SetParam

func (j PUJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type PistonJoint

type PistonJoint struct {
	JointBase
}

PistonJoint represents a piston joint.

func (PistonJoint) AddForce

func (j PistonJoint) AddForce(force float64)

AddForce adds a force to the joint.

func (PistonJoint) Anchor2

func (j PistonJoint) Anchor2() Vector3

Anchor2 returns the anchor point for the second body.

func (PistonJoint) Angle

func (j PistonJoint) Angle() float64

Angle returns the joint angle.

func (PistonJoint) AngleRate

func (j PistonJoint) AngleRate() float64

AngleRate returns the joint angle's rate of change.

func (PistonJoint) Axis

func (j PistonJoint) Axis() Vector3

Axis returns the piston axis.

func (PistonJoint) Param

func (j PistonJoint) Param(parameter int) float64

Param returns a joint parameter.

func (PistonJoint) Position

func (j PistonJoint) Position() float64

Position returns the piston position.

func (PistonJoint) PositionRate

func (j PistonJoint) PositionRate() float64

PositionRate returns the piston position's rate of change.

func (PistonJoint) SetAnchor

func (j PistonJoint) SetAnchor(pt Vector3)

SetAnchor sets the anchor point.

func (PistonJoint) SetAnchorOffset

func (j PistonJoint) SetAnchorOffset(pt, delta Vector3)

SetAnchorOffset sets the anchor as if the 2 bodies were already delta appart.

func (PistonJoint) SetAxis

func (j PistonJoint) SetAxis(axis Vector3)

SetAxis sets the piston axis.

func (PistonJoint) SetParam

func (j PistonJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type Plane

type Plane struct {
	GeomBase
}

Plane is a geometry that represents a plane.

func (Plane) Params

func (p Plane) Params() Vector4

Params returns plane parameters.

func (Plane) PointDepth

func (p Plane) PointDepth(pt Vector3) float64

PointDepth returns the depth of the given point.

func (Plane) SetParams

func (p Plane) SetParams(params Vector4)

SetParams sets plane parameters.

type Plane2DJoint

type Plane2DJoint struct {
	JointBase
}

Plane2DJoint represents a plane joint.

func (Plane2DJoint) SetAngleParam

func (j Plane2DJoint) SetAngleParam(parameter int, value float64)

SetAngleParam sets a joint parameter.

func (Plane2DJoint) SetXParam

func (j Plane2DJoint) SetXParam(parameter int, value float64)

SetXParam sets a joint parameter.

func (Plane2DJoint) SetYParam

func (j Plane2DJoint) SetYParam(parameter int, value float64)

SetYParam sets a joint parameter.

type PlaneList

type PlaneList Matrix

PlaneList represents a list of plane definitions.

func NewPlaneList

func NewPlaneList(size int, vals ...float64) PlaneList

NewPlaneList returns a new PlaneList instance.

type PolygonList

type PolygonList []C.uint

PolygonList represents a list of polygon definitions

type QuadTreeSpace

type QuadTreeSpace struct {
	SpaceBase
}

QuadTreeSpace represents a quad tree space.

type Quaternion

type Quaternion Vector

Quaternion represents a quaternion.

func NewQuaternion

func NewQuaternion(vals ...float64) Quaternion

NewQuaternion returns a new Quaternion instance.

type Ray

type Ray struct {
	GeomBase
}

Ray is a geometry representing a ray.

func (Ray) BackfaceCull

func (r Ray) BackfaceCull() bool

BackfaceCull returns whether backface culling is enabled.

func (Ray) ClosestHit

func (r Ray) ClosestHit() bool

ClosestHit returns whether only the closest hit will be reported.

func (Ray) FirstContact

func (r Ray) FirstContact() bool

FirstContact returns whether collision detection will stop after finding the first contact.

func (Ray) Length

func (r Ray) Length() float64

Length returns the length.

func (Ray) PosDir

func (r Ray) PosDir() (Vector3, Vector3)

PosDir returns the position and direction.

func (Ray) SetBackfaceCull

func (r Ray) SetBackfaceCull(backfaceCull bool)

SetBackfaceCull sets whether backface culling is enabled.

func (Ray) SetClosestHit

func (r Ray) SetClosestHit(closestHit bool)

SetClosestHit sets whether to only report the closest hit.

func (Ray) SetFirstContact

func (r Ray) SetFirstContact(firstContact bool)

SetFirstContact sets whether to stop collision detection after finding the first contact point.

func (Ray) SetLength

func (r Ray) SetLength(length float64)

SetLength sets the length.

func (Ray) SetPosDir

func (r Ray) SetPosDir(pos, dir Vector3)

SetPosDir sets the position and direction.

type SimpleSpace

type SimpleSpace struct {
	SpaceBase
}

SimpleSpace represents a simple space.

type SliderJoint

type SliderJoint struct {
	JointBase
}

SliderJoint represents a slider joints.

func (SliderJoint) AddForce

func (j SliderJoint) AddForce(force float64)

AddForce adds a force to the joint.

func (SliderJoint) Axis

func (j SliderJoint) Axis() Vector3

Axis returns the slider axis.

func (SliderJoint) Param

func (j SliderJoint) Param(parameter int) float64

Param returns a joint parameter.

func (SliderJoint) Position

func (j SliderJoint) Position() float64

Position returns the slider position.

func (SliderJoint) PositionRate

func (j SliderJoint) PositionRate() float64

PositionRate returns the slider position's rate of change.

func (SliderJoint) SetAxis

func (j SliderJoint) SetAxis(axis Vector3)

SetAxis sets the slider axis.

func (SliderJoint) SetAxisDelta

func (j SliderJoint) SetAxisDelta(pt, delta Vector3)

SetAxisDelta sets the slider axis delta.

func (SliderJoint) SetParam

func (j SliderJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type Space

type Space interface {
	Destroy()
	SetCleanup(mode bool)
	Cleanup() bool
	SetManualCleanup(mode bool)
	SetSublevel(sublevel int)
	Sublevel() int
	ManualCleanup() bool
	Clean()
	Class() int
	Add(g Geom)
	Remove(g Geom)
	Query(g Geom) bool
	NumGeoms(g Geom) int
	Geom(index int) Geom
	Collide(data interface{}, cb NearCallback)
	NewSphere(radius float64) Sphere
	NewBox(lens Vector3) Box
	NewPlane(params Vector4) Plane
	NewCapsule(radius, length float64) Capsule
	NewCylinder(radius, length float64) Cylinder
	NewRay(length float64) Ray
	NewHeightfield(data HeightfieldData, placeable bool) Heightfield
	NewSimpleSpace() SimpleSpace
	NewHashSpace() HashSpace
	NewQuadTreeSpace(center, extents Vector3, depth int) QuadTreeSpace
	NewSweepAndPruneSpace(axisOrder int) SweepAndPruneSpace
	// contains filtered or unexported methods
}

Space represents a space containing bodies.

func NilSpace

func NilSpace() Space

NilSpace returns the top level "0" space

type SpaceBase

type SpaceBase uintptr

SpaceBase implements Space, and is embedded by specific Space types.

func (SpaceBase) Add

func (s SpaceBase) Add(g Geom)

Add adds a geometry to the space.

func (SpaceBase) Class

func (s SpaceBase) Class() int

Class returns the space class.

func (SpaceBase) Clean

func (s SpaceBase) Clean()

Clean cleans the space.

func (SpaceBase) Cleanup

func (s SpaceBase) Cleanup() bool

Cleanup returns whether contained objects will be destroyed.

func (SpaceBase) Collide

func (s SpaceBase) Collide(data interface{}, cb NearCallback)

Collide tests for collision between contained objects.

func (SpaceBase) Destroy

func (s SpaceBase) Destroy()

Destroy destroys the space.

func (SpaceBase) Geom

func (s SpaceBase) Geom(index int) Geom

Geom returns the specified contained geometry.

func (SpaceBase) ManualCleanup

func (s SpaceBase) ManualCleanup() bool

ManualCleanup returns whether this space is marked for manual cleanup.

func (SpaceBase) NewBox

func (s SpaceBase) NewBox(lens Vector3) Box

NewBox returns a new Box instance.

func (SpaceBase) NewCapsule

func (s SpaceBase) NewCapsule(radius, length float64) Capsule

NewCapsule returns a new Capsule instance.

func (SpaceBase) NewConvex

func (s SpaceBase) NewConvex(planes PlaneList, pts VertexList, polyList PolygonList) Convex

NewConvex returns a new Convex instance.

func (SpaceBase) NewCylinder

func (s SpaceBase) NewCylinder(radius, length float64) Cylinder

NewCylinder returns a new Cylinder instance.

func (SpaceBase) NewHashSpace

func (s SpaceBase) NewHashSpace() HashSpace

NewHashSpace returns a new HashSpace instance.

func (SpaceBase) NewHeightfield

func (s SpaceBase) NewHeightfield(data HeightfieldData, placeable bool) Heightfield

NewHeightfield returns a new Heightfield instance.

func (SpaceBase) NewPlane

func (s SpaceBase) NewPlane(params Vector4) Plane

NewPlane returns a new Plane instance.

func (SpaceBase) NewQuadTreeSpace

func (s SpaceBase) NewQuadTreeSpace(center, extents Vector3, depth int) QuadTreeSpace

NewQuadTreeSpace returns a new QuadTreeSpace instance.

func (SpaceBase) NewRay

func (s SpaceBase) NewRay(length float64) Ray

NewRay returns a new Ray instance.

func (SpaceBase) NewSimpleSpace

func (s SpaceBase) NewSimpleSpace() SimpleSpace

NewSimpleSpace returns a new SimpleSpace instance.

func (SpaceBase) NewSphere

func (s SpaceBase) NewSphere(radius float64) Sphere

NewSphere returns a new Sphere instance.

func (SpaceBase) NewSweepAndPruneSpace

func (s SpaceBase) NewSweepAndPruneSpace(axisOrder int) SweepAndPruneSpace

NewSweepAndPruneSpace returns a new SweepAndPruneSpace instance.

func (SpaceBase) NewTriMesh

func (s SpaceBase) NewTriMesh(data TriMeshData) TriMesh

NewTriMesh returns a new TriMesh instance.

func (SpaceBase) NumGeoms

func (s SpaceBase) NumGeoms(g Geom) int

NumGeoms returns the number of geometries contained in the space.

func (SpaceBase) Query

func (s SpaceBase) Query(g Geom) bool

Query returns whether a geometry is contained in the space.

func (SpaceBase) Remove

func (s SpaceBase) Remove(g Geom)

Remove removes a geometry from the space.

func (SpaceBase) SetCleanup

func (s SpaceBase) SetCleanup(mode bool)

SetCleanup sets whether contained objects will be destroyed.

func (SpaceBase) SetManualCleanup

func (s SpaceBase) SetManualCleanup(mode bool)

SetManualCleanup sets whether this space is marked for manual cleanup.

func (SpaceBase) SetSublevel

func (s SpaceBase) SetSublevel(sublevel int)

SetSublevel sets the sublevel for this space.

func (SpaceBase) Sublevel

func (s SpaceBase) Sublevel() int

Sublevel returns the sublevel for this space.

type Sphere

type Sphere struct {
	GeomBase
}

Sphere is a geometry representing a sphere.

func (Sphere) Radius

func (s Sphere) Radius() float64

Radius returns the radius.

func (Sphere) SetRadius

func (s Sphere) SetRadius(radius float64)

SetRadius sets the radius.

func (Sphere) SpherePointDepth

func (s Sphere) SpherePointDepth(pt Vector3) float64

SpherePointDepth returns the depth of the given point.

type SurfaceParameters

type SurfaceParameters struct {
	// must always be defined
	Mode int
	Mu   float64

	// only defined if the corresponding flag is set in mode
	Mu2       float64
	Rho       float64
	Rho2      float64
	RhoN      float64
	Bounce    float64
	BounceVel float64
	SoftErp   float64
	SoftCfm   float64
	Motion1   float64
	Motion2   float64
	MotionN   float64
	Slip1     float64
	Slip2     float64
}

SurfaceParameters represents the parameters of a contact surface.

type SweepAndPruneSpace

type SweepAndPruneSpace struct {
	SpaceBase
}

SweepAndPruneSpace represents a sweep and prune space.

type TransmissionJoint

type TransmissionJoint struct {
	JointBase
}

TransmissionJoint represents a transmission joint.

func (TransmissionJoint) Anchor1

func (j TransmissionJoint) Anchor1() Vector3

Anchor1 returns the anchor point for the first body.

func (TransmissionJoint) Anchor2

func (j TransmissionJoint) Anchor2() Vector3

Anchor2 returns the anchor point for the second body.

func (TransmissionJoint) Angle1

func (j TransmissionJoint) Angle1() float64

Angle1 returns the angle of the first wheel.

func (TransmissionJoint) Angle2

func (j TransmissionJoint) Angle2() float64

Angle2 returns the angle of the second wheel.

func (TransmissionJoint) Axis

func (j TransmissionJoint) Axis() Vector3

Axis returns the common axis.

func (TransmissionJoint) Axis1

func (j TransmissionJoint) Axis1() Vector3

Axis1 returns the first axis.

func (TransmissionJoint) Axis2

func (j TransmissionJoint) Axis2() Vector3

Axis2 returns the second axis.

func (TransmissionJoint) Backlash

func (j TransmissionJoint) Backlash() float64

Backlash returns the backlash (gear tooth play distance).

func (TransmissionJoint) ContactPoint1

func (j TransmissionJoint) ContactPoint1() Vector3

ContactPoint1 returns the contact point on the first wheel.

func (TransmissionJoint) ContactPoint2

func (j TransmissionJoint) ContactPoint2() Vector3

ContactPoint2 returns the contact point on the second wheel.

func (TransmissionJoint) Mode

func (j TransmissionJoint) Mode() int

Mode returns the transmission mode.

func (TransmissionJoint) Param

func (j TransmissionJoint) Param(parameter int) float64

Param returns a joint parameter.

func (TransmissionJoint) Radius1

func (j TransmissionJoint) Radius1() float64

Radius1 returns the radius of the first wheel.

func (TransmissionJoint) Radius2

func (j TransmissionJoint) Radius2() float64

Radius2 returns the radius of the second wheel.

func (TransmissionJoint) Ratio

func (j TransmissionJoint) Ratio() float64

Ratio returns the gear ratio.

func (TransmissionJoint) SetAnchor1

func (j TransmissionJoint) SetAnchor1(pt Vector3)

SetAnchor1 sets the anchor point for the first body.

func (TransmissionJoint) SetAnchor2

func (j TransmissionJoint) SetAnchor2(pt Vector3)

SetAnchor2 sets the anchor point for the second body.

func (TransmissionJoint) SetAxis

func (j TransmissionJoint) SetAxis(axis Vector3)

SetAxis sets the common axis.

func (TransmissionJoint) SetAxis1

func (j TransmissionJoint) SetAxis1(axis Vector3)

SetAxis1 sets the first axis.

func (TransmissionJoint) SetAxis2

func (j TransmissionJoint) SetAxis2(axis Vector3)

SetAxis2 sets the second axis.

func (TransmissionJoint) SetBacklash

func (j TransmissionJoint) SetBacklash(backlash float64)

SetBacklash set the backlash (gear tooth play distance).

func (TransmissionJoint) SetMode

func (j TransmissionJoint) SetMode(mode int)

SetMode sets the transmission mode.

func (TransmissionJoint) SetParam

func (j TransmissionJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

func (TransmissionJoint) SetRadius1

func (j TransmissionJoint) SetRadius1(radius float64)

SetRadius1 sets the radius of the first wheel.

func (TransmissionJoint) SetRadius2

func (j TransmissionJoint) SetRadius2(radius float64)

SetRadius2 sets the radius of the second wheel.

func (TransmissionJoint) SetRatio

func (j TransmissionJoint) SetRatio(ratio float64)

SetRatio sets the gear ratio.

type TriCallback

type TriCallback func(mesh TriMesh, other Geom, index int) bool

TriCallback is called to determine whether to collide a triangle with another geometry.

type TriMesh

type TriMesh struct {
	GeomBase
}

TriMesh is a geometry representing a triangle mesh.

func (TriMesh) ClearTCCache

func (t TriMesh) ClearTCCache()

ClearTCCache clears the temporal coherence cache.

func (TriMesh) LastTransform

func (t TriMesh) LastTransform() Matrix4

LastTransform returns the last transform.

func (TriMesh) MeshData

func (t TriMesh) MeshData() TriMeshData

MeshData returns the mesh data.

func (TriMesh) Point

func (t TriMesh) Point(index int, u, v float64) Vector3

Point returns a point on the specified triangle at the given barycentric coordinates.

func (TriMesh) SetLastTransform

func (t TriMesh) SetLastTransform(xform Matrix4)

SetLastTransform sets the last transform.

func (TriMesh) SetMeshData

func (t TriMesh) SetMeshData(data TriMeshData)

SetMeshData sets the mesh data.

func (TriMesh) SetTCEnabled

func (t TriMesh) SetTCEnabled(class int, isEnabled bool)

SetTCEnabled sets whether temporal coherence is enabled for the given geometry class.

func (TriMesh) SetTriCallback

func (t TriMesh) SetTriCallback(cb TriCallback)

SetTriCallback sets the triangle collision callback.

func (TriMesh) SetTriRayCallback

func (t TriMesh) SetTriRayCallback(cb TriRayCallback)

SetTriRayCallback sets the triangle/ray collision callback.

func (TriMesh) TCEnabled

func (t TriMesh) TCEnabled(class int) bool

TCEnabled returns whether temporal coherence is enabled for the given geometry class.

func (TriMesh) TriCallback

func (t TriMesh) TriCallback() TriCallback

TriCallback returns the triangle collision callback.

func (TriMesh) TriRayCallback

func (t TriMesh) TriRayCallback() TriRayCallback

TriRayCallback returns the triangle/ray collision callback.

func (TriMesh) Triangle

func (t TriMesh) Triangle(index int) (Vector3, Vector3, Vector3)

Triangle returns a triangle in the mesh by index.

func (TriMesh) TriangleCount

func (t TriMesh) TriangleCount() int

TriangleCount returns the number of triangles in the mesh.

type TriMeshData

type TriMeshData uintptr

TriMeshData represents triangle mesh data.

func NewTriMeshData

func NewTriMeshData() TriMeshData

NewTriMeshData returns a new TriMeshData instance.

func (TriMeshData) Build

func (t TriMeshData) Build(verts VertexList, tris TriVertexIndexList)

Build builds a triangle mesh from the given data.

func (TriMeshData) Destroy

func (t TriMeshData) Destroy()

Destroy destroys the triangle mesh data.

func (TriMeshData) Preprocess

func (t TriMeshData) Preprocess()

Preprocess preprocesses the triangle mesh data.

func (TriMeshData) Update

func (t TriMeshData) Update()

Update updates the triangle mesh data.

type TriRayCallback

type TriRayCallback func(mesh TriMesh, ray Ray, index int, u, v float64) bool

TriRayCallback is called to determine whether to collide a triangle with a ray at a given point.

type TriVertexIndexList

type TriVertexIndexList [][]uint32

TriVertexIndexList represents a list of triangle vertex indices.

func NewTriVertexIndexList

func NewTriVertexIndexList(size int, indices ...uint32) TriVertexIndexList

NewTriVertexIndexList returns a new TriVertexIndexList instance.

type UniversalJoint

type UniversalJoint struct {
	JointBase
}

UniversalJoint represents a universal joint.

func (UniversalJoint) AddTorques

func (j UniversalJoint) AddTorques(torque1, torque2 float64)

AddTorques adds torques to the joint.

func (UniversalJoint) Anchor

func (j UniversalJoint) Anchor() Vector3

Anchor returns the anchor point for the first body.

func (UniversalJoint) Anchor2

func (j UniversalJoint) Anchor2() Vector3

Anchor2 returns the anchor point for the second body.

func (UniversalJoint) Angle1

func (j UniversalJoint) Angle1() float64

Angle1 returns the first angle.

func (UniversalJoint) Angle1Rate

func (j UniversalJoint) Angle1Rate() float64

Angle1Rate returns the first angle's rate of change.

func (UniversalJoint) Angle2

func (j UniversalJoint) Angle2() float64

Angle2 returns the second angle.

func (UniversalJoint) Angle2Rate

func (j UniversalJoint) Angle2Rate() float64

Angle2Rate returns the second angle's rate of change.

func (UniversalJoint) Angles

func (j UniversalJoint) Angles() (float64, float64)

Angles returns the two angles.

func (UniversalJoint) Axis1

func (j UniversalJoint) Axis1() Vector3

Axis1 returns the first axis.

func (UniversalJoint) Axis2

func (j UniversalJoint) Axis2() Vector3

Axis2 returns the second axis.

func (UniversalJoint) Param

func (j UniversalJoint) Param(parameter int) float64

Param returns a joint parameter.

func (UniversalJoint) SetAnchor

func (j UniversalJoint) SetAnchor(pt Vector3)

SetAnchor sets the anchor point.

func (UniversalJoint) SetAxis1

func (j UniversalJoint) SetAxis1(axis Vector3)

SetAxis1 sets the first axis.

func (UniversalJoint) SetAxis1Offset

func (j UniversalJoint) SetAxis1Offset(axis Vector3, offset1, offset2 float64)

SetAxis1Offset sets the first axis as if the 2 bodies were already at offset1 and offset2 appart with respect to the first and second axes.

func (UniversalJoint) SetAxis2

func (j UniversalJoint) SetAxis2(axis Vector3)

SetAxis2 sets the second axis.

func (UniversalJoint) SetAxis2Offset

func (j UniversalJoint) SetAxis2Offset(axis Vector3, offset1, offset2 float64)

SetAxis2Offset sets the second axis as if the 2 bodies were already at offset1 and offset2 appart with respect to the first and second axes.

func (UniversalJoint) SetParam

func (j UniversalJoint) SetParam(parameter int, value float64)

SetParam sets a joint parameter.

type Vector

type Vector []float64

Vector represents a double precision vector.

func NewVector

func NewVector(size, align int, vals ...float64) Vector

NewVector returns a new Vector instance.

type Vector3

type Vector3 Vector

Vector3 represents a 3 component vector.

func NewVector3

func NewVector3(vals ...float64) Vector3

NewVector3 returns a new Vector3 instance.

type Vector4

type Vector4 Vector

Vector4 represents a 4 component vector.

func NewVector4

func NewVector4(vals ...float64) Vector4

NewVector4 returns a new Vector4 instance.

type VertexList

type VertexList Matrix

VertexList represents a list of 3D vertices.

func NewVertexList

func NewVertexList(size int, vals ...float64) VertexList

NewVertexList returns a new VertexList instance.

type World

type World uintptr

World represents a simulation world.

func NewWorld

func NewWorld() World

NewWorld returns a new World instance.

func (World) AngularDamping

func (w World) AngularDamping() float64

AngularDamping returns the angular damping scale.

func (World) AngularDampingThreshold

func (w World) AngularDampingThreshold() float64

AngularDampingThreshold returns the angular damping threshold.

func (World) AutoDisable

func (w World) AutoDisable() bool

AutoDisable returns whether the body will be auto disabled.

func (World) AutoDisableAngularThreshold

func (w World) AutoDisableAngularThreshold() float64

AutoDisableAngularThreshold returns the auto disable angular average threshold.

func (World) AutoDisableAverageSamplesCount

func (w World) AutoDisableAverageSamplesCount() bool

AutoDisableAverageSamplesCount returns the auto disable sample count.

func (World) AutoDisableLinearThreshold

func (w World) AutoDisableLinearThreshold() float64

AutoDisableLinearThreshold returns the auto disable linear average threshold.

func (World) AutoDisableSteps

func (w World) AutoDisableSteps() int

AutoDisableSteps returns the number of auto disable steps.

func (World) AutoDisableTime

func (w World) AutoDisableTime() float64

AutoDisableTime returns the auto disable time.

func (World) CFM

func (w World) CFM() float64

CFM returns the constraint force mixing value.

func (World) CleanupWorkingMemory

func (w World) CleanupWorkingMemory()

CleanupWorkingMemory cleans up the world's working memory.

func (World) ContactMaxCorrectingVelocity

func (w World) ContactMaxCorrectingVelocity() float64

ContactMaxCorrectingVelocity returns the maximum correcting velocity that contacts are allowed to generate.

func (World) ContactSurfaceLayer

func (w World) ContactSurfaceLayer() float64

ContactSurfaceLayer returns the depth of the surface layer around all geometry objects.

func (World) Data

func (w World) Data() interface{}

Data returns the user-specified data associated with the world.

func (World) Destroy

func (w World) Destroy()

Destroy destroys the world.

func (World) ERP

func (w World) ERP() float64

ERP returns the error reduction parameter.

func (World) Gravity

func (w World) Gravity() Vector3

Gravity returns the gravity vector.

func (World) ImpulseToForce

func (w World) ImpulseToForce(stepSize float64, impulse Vector3) Vector3

ImpulseToForce converts an impulse to a force over a step duration.

func (World) LinearDamping

func (w World) LinearDamping() float64

LinearDamping returns the linear damping scale.

func (World) LinearDampingThreshold

func (w World) LinearDampingThreshold() float64

LinearDampingThreshold returns the linear damping threshold.

func (World) MaxAngularSpeed

func (w World) MaxAngularSpeed() float64

MaxAngularSpeed returns the maximum angular speed.

func (World) NewAMotorJoint

func (w World) NewAMotorJoint(group JointGroup) AMotorJoint

NewAMotorJoint returns a new AMotorJoint instance

func (World) NewBallJoint

func (w World) NewBallJoint(group JointGroup) BallJoint

NewBallJoint returns a new BallJoint instance

func (World) NewBody

func (w World) NewBody() Body

NewBody returns a new Body instance.

func (World) NewContactJoint

func (w World) NewContactJoint(group JointGroup, contact *Contact) ContactJoint

NewContactJoint returns a new ContactJoint instance

func (World) NewDBallJoint

func (w World) NewDBallJoint(group JointGroup) DBallJoint

NewDBallJoint returns a new DBallJoint instance

func (World) NewDHingeJoint

func (w World) NewDHingeJoint(group JointGroup) DHingeJoint

NewDHingeJoint returns a new DHingeJoint instance

func (World) NewFixedJoint

func (w World) NewFixedJoint(group JointGroup) FixedJoint

NewFixedJoint returns a new FixedJoint instance

func (World) NewHinge2Joint

func (w World) NewHinge2Joint(group JointGroup) Hinge2Joint

NewHinge2Joint returns a new Hinge2Joint instance

func (World) NewHingeJoint

func (w World) NewHingeJoint(group JointGroup) HingeJoint

NewHingeJoint returns a new HingeJoint instance

func (World) NewLMotorJoint

func (w World) NewLMotorJoint(group JointGroup) LMotorJoint

NewLMotorJoint returns a new LMotorJoint instance

func (World) NewNullJoint

func (w World) NewNullJoint(group JointGroup) NullJoint

NewNullJoint returns a new NullJoint instance

func (World) NewPRJoint

func (w World) NewPRJoint(group JointGroup) PRJoint

NewPRJoint returns a new PRJoint instance

func (World) NewPUJoint

func (w World) NewPUJoint(group JointGroup) PUJoint

NewPUJoint returns a new PUJoint instance

func (World) NewPistonJoint

func (w World) NewPistonJoint(group JointGroup) PistonJoint

NewPistonJoint returns a new PistonJoint instance

func (World) NewPlane2DJoint

func (w World) NewPlane2DJoint(group JointGroup) Plane2DJoint

NewPlane2DJoint returns a new Plane2DJoint instance

func (World) NewSliderJoint

func (w World) NewSliderJoint(group JointGroup) SliderJoint

NewSliderJoint returns a new SliderJoint instance

func (World) NewTransmissionJoint

func (w World) NewTransmissionJoint(group JointGroup) TransmissionJoint

NewTransmissionJoint returns a new TransmissionJoint instance

func (World) NewUniversalJoint

func (w World) NewUniversalJoint(group JointGroup) UniversalJoint

NewUniversalJoint returns a new UniversalJoint instance

func (World) QuickStep

func (w World) QuickStep(stepSize float64) bool

QuickStep executes a simulation quick step, and returns whether the operation succeeded.

func (World) QuickStepNumIterations

func (w World) QuickStepNumIterations() int

QuickStepNumIterations returns the number of iterations to execute during a quick step.

func (World) QuickStepW

func (w World) QuickStepW() float64

QuickStepW returns the over-relaxation parameter.

func (World) SetAngularDamping

func (w World) SetAngularDamping(scale float64)

SetAngularDamping sets the angular damping scale.

func (World) SetAngularDampingThreshold

func (w World) SetAngularDampingThreshold(threshold float64)

SetAngularDampingThreshold sets the angular damping threshold.

func (World) SetAutoAutoDisableAverageSamplesCount

func (w World) SetAutoAutoDisableAverageSamplesCount(averageSamplesCount bool)

SetAutoAutoDisableAverageSamplesCount sets auto disable average sample count.

func (World) SetAutoDisable

func (w World) SetAutoDisable(doAutoDisable bool)

SetAutoDisable sets wether the body will be auto disabled.

func (World) SetAutoDisableAngularThreshold

func (w World) SetAutoDisableAngularThreshold(angularThreshold float64)

SetAutoDisableAngularThreshold sets the auto disable angular average threshold.

func (World) SetAutoDisableLinearThreshold

func (w World) SetAutoDisableLinearThreshold(linearThreshold float64)

SetAutoDisableLinearThreshold sets the auto disable linear average threshold.

func (World) SetAutoDisableSteps

func (w World) SetAutoDisableSteps(steps int)

SetAutoDisableSteps sets the number of auto disable steps.

func (World) SetAutoDisableTime

func (w World) SetAutoDisableTime(time float64)

SetAutoDisableTime sets the auto disable time.

func (World) SetCFM

func (w World) SetCFM(cfm float64)

SetCFM sets the constraint force mixing value.

func (World) SetContactMaxCorrectingVelocity

func (w World) SetContactMaxCorrectingVelocity(overRelaxation float64)

SetContactMaxCorrectingVelocity sets the maximum correcting velocity that contacts are allowed to generate.

func (World) SetContactSurfaceLayer

func (w World) SetContactSurfaceLayer(depth float64)

SetContactSurfaceLayer sets the depth of the surface layer around all geometry objects.

func (World) SetData

func (w World) SetData(data interface{})

SetData associates user-specified data with the world.

func (World) SetERP

func (w World) SetERP(erp float64)

SetERP sets the error reduction parameter.

func (World) SetGravity

func (w World) SetGravity(grav Vector3)

SetGravity sets the gravity vector.

func (World) SetLinearDamping

func (w World) SetLinearDamping(scale float64)

SetLinearDamping sets the linear damping scale.

func (World) SetLinearDampingThreshold

func (w World) SetLinearDampingThreshold(threshold float64)

SetLinearDampingThreshold sets the linear damping threshold.

func (World) SetMaxAngularSpeed

func (w World) SetMaxAngularSpeed(maxSpeed float64)

SetMaxAngularSpeed sets the maximum angular speed.

func (World) SetQuickStepNumIterations

func (w World) SetQuickStepNumIterations(num int)

SetQuickStepNumIterations sets the number of iterations to execute during a quick step.

func (World) SetQuickStepW

func (w World) SetQuickStepW(overRelaxation float64)

SetQuickStepW sets the over-relaxation parameter.

func (World) SetStepIslandsProcessingMaxThreadCount

func (w World) SetStepIslandsProcessingMaxThreadCount(count int)

SetStepIslandsProcessingMaxThreadCount sets the maximum number of threads to use for island stepping.

func (World) Step

func (w World) Step(stepSize float64) bool

Step executes a simulation step, and returns whether the operation succeeded.

func (World) StepIslandsProcessingMaxThreadCount

func (w World) StepIslandsProcessingMaxThreadCount() int

StepIslandsProcessingMaxThreadCount returns the maximum number of threads to use for island stepping.

func (World) UseSharedWorkingMemory

func (w World) UseSharedWorkingMemory(from World) bool

UseSharedWorkingMemory enables sharing working memory with another world, and returns whether the operation succeeded.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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