Documentation ¶
Index ¶
- Constants
- Variables
- func AsNode(k tree.Node) (Node, *NodeBase)
- type BBox
- type Body
- type BodyBase
- func (bb *BodyBase) AsBody() Body
- func (bb *BodyBase) AsBodyBase() *BodyBase
- func (bb *BodyBase) GroupBBox()
- func (t *BodyBase) New() tree.Node
- func (t *BodyBase) NodeType() *types.Type
- func (t *BodyBase) SetColor(v string) *BodyBase
- func (bb *BodyBase) SetDynamic() *BodyBase
- func (t *BodyBase) SetInitial(v State) *BodyBase
- func (t *BodyBase) SetRel(v State) *BodyBase
- func (t *BodyBase) SetRigid(v Rigid) *BodyBase
- func (t *BodyBase) SetVis(v string) *BodyBase
- type BodyPoint
- type Box
- func (bx *Box) InitAbs(par *NodeBase)
- func (t *Box) New() tree.Node
- func (t *Box) NodeType() *types.Type
- func (bx *Box) RelToAbs(par *NodeBase)
- func (bx *Box) SetBBox()
- func (t *Box) SetColor(v string) *Box
- func (t *Box) SetInitial(v State) *Box
- func (t *Box) SetRel(v State) *Box
- func (t *Box) SetRigid(v Rigid) *Box
- func (t *Box) SetSize(v math32.Vector3) *Box
- func (t *Box) SetVis(v string) *Box
- func (bx *Box) Step(step float32)
- type Capsule
- func (cp *Capsule) InitAbs(par *NodeBase)
- func (t *Capsule) New() tree.Node
- func (t *Capsule) NodeType() *types.Type
- func (cp *Capsule) RelToAbs(par *NodeBase)
- func (cp *Capsule) SetBBox()
- func (t *Capsule) SetBotRad(v float32) *Capsule
- func (t *Capsule) SetColor(v string) *Capsule
- func (t *Capsule) SetHeight(v float32) *Capsule
- func (t *Capsule) SetInitial(v State) *Capsule
- func (t *Capsule) SetRel(v State) *Capsule
- func (t *Capsule) SetRigid(v Rigid) *Capsule
- func (t *Capsule) SetTopRad(v float32) *Capsule
- func (t *Capsule) SetVis(v string) *Capsule
- func (cp *Capsule) Step(step float32)
- type Contact
- type Contacts
- type Cylinder
- func (cy *Cylinder) InitAbs(par *NodeBase)
- func (t *Cylinder) New() tree.Node
- func (t *Cylinder) NodeType() *types.Type
- func (cy *Cylinder) RelToAbs(par *NodeBase)
- func (cy *Cylinder) SetBBox()
- func (t *Cylinder) SetBotRad(v float32) *Cylinder
- func (t *Cylinder) SetColor(v string) *Cylinder
- func (t *Cylinder) SetHeight(v float32) *Cylinder
- func (t *Cylinder) SetInitial(v State) *Cylinder
- func (t *Cylinder) SetRel(v State) *Cylinder
- func (t *Cylinder) SetRigid(v Rigid) *Cylinder
- func (t *Cylinder) SetTopRad(v float32) *Cylinder
- func (t *Cylinder) SetVis(v string) *Cylinder
- func (cy *Cylinder) Step(step float32)
- type Group
- func (gp *Group) GroupBBox()
- func (gp *Group) InitAbs(par *NodeBase)
- func (t *Group) New() tree.Node
- func (t *Group) NodeType() *types.Type
- func (gp *Group) RayBodyIntersections(ray math32.Ray) []*BodyPoint
- func (gp *Group) RelToAbs(par *NodeBase)
- func (t *Group) SetInitial(v State) *Group
- func (t *Group) SetRel(v State) *Group
- func (gp *Group) Step(step float32)
- func (gp *Group) WorldCollide(dynTop bool) []Contacts
- func (gp *Group) WorldDynGroupBBox()
- func (gp *Group) WorldInit()
- func (gp *Group) WorldRelToAbs()
- func (gp *Group) WorldStep(step float32)
- type Node
- type NodeBase
- func (nb *NodeBase) AsBody() Body
- func (nb *NodeBase) AsNodeBase() *NodeBase
- func (nb *NodeBase) InitAbsBase(par *NodeBase)
- func (nb *NodeBase) IsDynamic() bool
- func (t *NodeBase) New() tree.Node
- func (t *NodeBase) NodeType() *types.Type
- func (nb *NodeBase) RelToAbsBase(par *NodeBase)
- func (nb *NodeBase) SetInitAngVel(vel math32.Vector3) *NodeBase
- func (nb *NodeBase) SetInitLinVel(vel math32.Vector3) *NodeBase
- func (nb *NodeBase) SetInitPos(pos math32.Vector3) *NodeBase
- func (nb *NodeBase) SetInitQuat(quat math32.Quat) *NodeBase
- func (t *NodeBase) SetInitial(v State) *NodeBase
- func (t *NodeBase) SetRel(v State) *NodeBase
- func (nb *NodeBase) StepBase(step float32)
- type NodeFlags
- func (i NodeFlags) BitIndexString() string
- func (i NodeFlags) Desc() string
- func (i NodeFlags) HasFlag(f enums.BitFlag) bool
- func (i NodeFlags) Int64() int64
- func (i NodeFlags) MarshalText() ([]byte, error)
- func (i *NodeFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *NodeFlags) SetInt64(in int64)
- func (i *NodeFlags) SetString(s string) error
- func (i *NodeFlags) SetStringOr(s string) error
- func (i NodeFlags) String() string
- func (i *NodeFlags) UnmarshalText(text []byte) error
- func (i NodeFlags) Values() []enums.Enum
- type Rigid
- type Sphere
- func (sp *Sphere) InitAbs(par *NodeBase)
- func (t *Sphere) New() tree.Node
- func (t *Sphere) NodeType() *types.Type
- func (sp *Sphere) RelToAbs(par *NodeBase)
- func (sp *Sphere) SetBBox()
- func (t *Sphere) SetColor(v string) *Sphere
- func (t *Sphere) SetInitial(v State) *Sphere
- func (t *Sphere) SetRadius(v float32) *Sphere
- func (t *Sphere) SetRel(v State) *Sphere
- func (t *Sphere) SetRigid(v Rigid) *Sphere
- func (t *Sphere) SetVis(v string) *Sphere
- func (sp *Sphere) Step(step float32)
- type State
- func (ps *State) Defaults()
- func (ps *State) EulerRotation() math32.Vector3
- func (ps *State) EulerRotationRad() math32.Vector3
- func (ps *State) FromRel(rel, par *State)
- func (ps *State) Move(delta math32.Vector3)
- func (ps *State) MoveOnAxis(x, y, z, dist float32)
- func (ps *State) MoveOnAxisAbs(x, y, z, dist float32)
- func (ps *State) RotateEuler(x, y, z float32)
- func (ps *State) RotateEulerRad(x, y, z, angle float32)
- func (ps *State) RotateOnAxis(x, y, z, angle float32)
- func (ps *State) RotateOnAxisRad(x, y, z, angle float32)
- func (ps *State) SetAxisRotation(x, y, z, angle float32)
- func (ps *State) SetAxisRotationRad(x, y, z, angle float32)
- func (ps *State) SetEulerRotation(x, y, z float32)
- func (ps *State) SetEulerRotationRad(x, y, z float32)
- func (ps *State) StepByAngVel(step float32)
- func (ps *State) StepByLinVel(step float32)
Constants ¶
const ( // DynsTopGps is passed to WorldCollide when all dynamic objects are in separate top groups DynsTopGps = true // DynsSubGps is passed to WorldCollide when all dynamic objects are in separate groups under top // level (i.e., one level deeper) DynsSubGps )
const AngMotionMax = math.Pi / 4
AngMotionMax is maximum angular motion that can be taken per update
Variables ¶
var BodyBaseType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyz/physics.BodyBase", IDName: "body-base", Doc: "BodyBase is the base type for all specific Body types", Embeds: []types.Field{{Name: "NodeBase"}}, Fields: []types.Field{{Name: "Rigid", Doc: "rigid body properties, including mass, bounce, friction etc"}, {Name: "Vis", Doc: "visualization name -- looks up an entry in the scene library that provides the visual representation of this body"}, {Name: "Color", Doc: "default color of body for basic InitLibrary configuration"}}, Instance: &BodyBase{}})
BodyBaseType is the types.Type for BodyBase
var BoxType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyz/physics.Box", IDName: "box", Doc: "Box is a box body shape", Embeds: []types.Field{{Name: "BodyBase"}}, Fields: []types.Field{{Name: "Size", Doc: "size of box in each dimension (units arbitrary, as long as they are all consistent -- meters is typical)"}}, Instance: &Box{}})
BoxType is the types.Type for Box
var CapsuleType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyz/physics.Capsule", IDName: "capsule", Doc: "Capsule is a generalized cylinder body shape, with hemispheres at each end,\nwith separate radii for top and bottom.", Embeds: []types.Field{{Name: "BodyBase"}}, Fields: []types.Field{{Name: "Height", Doc: "height of the cylinder portion of the capsule"}, {Name: "TopRad", Doc: "radius of the top hemisphere"}, {Name: "BotRad", Doc: "radius of the bottom hemisphere"}}, Instance: &Capsule{}})
CapsuleType is the types.Type for Capsule
var CylinderType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyz/physics.Cylinder", IDName: "cylinder", Doc: "Cylinder is a generalized cylinder body shape, with separate radii for top and bottom.\nA cone has a zero radius at one end.", Embeds: []types.Field{{Name: "BodyBase"}}, Fields: []types.Field{{Name: "Height", Doc: "height of the cylinder"}, {Name: "TopRad", Doc: "radius of the top -- set to 0 for a cone"}, {Name: "BotRad", Doc: "radius of the bottom"}}, Instance: &Cylinder{}})
CylinderType is the types.Type for Cylinder
var GroupType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyz/physics.Group", IDName: "group", Doc: "Group is a container of bodies, joints, or other groups\nit should be used strategically to partition the space\nand its BBox is used to optimize tree-based collision detection.\nUse a group for the top-level World node as well.", Embeds: []types.Field{{Name: "NodeBase"}}, Instance: &Group{}})
GroupType is the types.Type for Group
var NodeBaseType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyz/physics.NodeBase", IDName: "node-base", Doc: "NodeBase is the basic node, which has position, rotation, velocity\nand computed bounding boxes, etc.\nThere are only three different kinds of Nodes: Group, Body, and Joint", Embeds: []types.Field{{Name: "NodeBase"}}, Fields: []types.Field{{Name: "Initial", Doc: "initial position, orientation, velocity in *local* coordinates (relative to parent)"}, {Name: "Rel", Doc: "current relative (local) position, orientation, velocity -- only change these values, as abs values are computed therefrom"}, {Name: "Abs", Doc: "current absolute (world) position, orientation, velocity"}, {Name: "BBox", Doc: "bounding box in world coordinates (aggregated for groups)"}}, Instance: &NodeBase{}})
NodeBaseType is the types.Type for NodeBase
var SphereType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyz/physics.Sphere", IDName: "sphere", Doc: "Sphere is a spherical body shape.", Embeds: []types.Field{{Name: "BodyBase"}}, Fields: []types.Field{{Name: "Radius", Doc: "radius"}}, Instance: &Sphere{}})
SphereType is the types.Type for Sphere
Functions ¶
Types ¶
type BBox ¶
type BBox struct { // bounding box in world coords (Axis-Aligned Bounding Box = AABB) BBox math32.Box3 // velocity-projected bounding box in world coords: extend BBox to include future position of moving bodies -- collision must be made on this basis VelBBox math32.Box3 // bounding sphere in local coords BSphere math32.Sphere // area Area float32 // volume Volume float32 }
BBox contains bounding box and other gross object properties
func (*BBox) IntersectsVelBox ¶
IntersectsVelBox returns true if two velocity-projected bounding boxes intersect
func (*BBox) UpdateFromBBox ¶
func (bb *BBox) UpdateFromBBox()
UpdateFromBBox updates other values from BBox
func (*BBox) VelNilProject ¶
func (bb *BBox) VelNilProject()
VelNilProject is for static items -- just copy the BBox
func (*BBox) VelProject ¶
VelProject computes the velocity-projected bounding box for given velocity and step size
type Body ¶
type Body interface { Node // AsBodyBase returns the body as a BodyBase AsBodyBase() *BodyBase // SetDynamic sets the Dynamic flag for this body, indicating that it moves. // It is important to collect all dynamic objects into separate top-level group(s) // for more efficiently organizing the collision detection process. SetDynamic() *BodyBase }
Body is the common interface for all body types
type BodyBase ¶
type BodyBase struct { NodeBase // rigid body properties, including mass, bounce, friction etc Rigid Rigid // visualization name -- looks up an entry in the scene library that provides the visual representation of this body Vis string // default color of body for basic InitLibrary configuration Color string }
BodyBase is the base type for all specific Body types
func NewBodyBase ¶
NewBodyBase adds a new BodyBase with the given name to the given parent: BodyBase is the base type for all specific Body types
func (*BodyBase) AsBodyBase ¶
func (*BodyBase) NodeType ¶
NodeType returns the *types.Type of BodyBase
func (*BodyBase) SetColor ¶
SetColor sets the [BodyBase.Color]: default color of body for basic InitLibrary configuration
func (*BodyBase) SetDynamic ¶
func (*BodyBase) SetInitial ¶
SetInitial sets the [BodyBase.Initial]
type Box ¶
type Box struct { BodyBase // size of box in each dimension (units arbitrary, as long as they are all consistent -- meters is typical) Size math32.Vector3 }
Box is a box body shape
func NewBox ¶
NewBox adds a new Box with the given name to the given parent: Box is a box body shape
type Capsule ¶
type Capsule struct { BodyBase // height of the cylinder portion of the capsule Height float32 // radius of the top hemisphere TopRad float32 // radius of the bottom hemisphere BotRad float32 }
Capsule is a generalized cylinder body shape, with hemispheres at each end, with separate radii for top and bottom.
func NewCapsule ¶
NewCapsule adds a new Capsule with the given name to the given parent: Capsule is a generalized cylinder body shape, with hemispheres at each end, with separate radii for top and bottom.
func (*Capsule) NodeType ¶
NodeType returns the *types.Type of Capsule
func (*Capsule) SetHeight ¶
SetHeight sets the [Capsule.Height]: height of the cylinder portion of the capsule
func (*Capsule) SetInitial ¶
SetInitial sets the [Capsule.Initial]
type Contact ¶
type Contact struct { // one body A Body // the other body B Body // normal pointing from center of B to center of A NormB math32.Vector3 // point on spherical shell of B where A is contacting PtB math32.Vector3 // distance from PtB along NormB to contact point on spherical shell of A Dist float32 }
Contact is one pairwise point of contact between two bodies. Contacts are represented in spherical terms relative to the spherical BBox of A and B.
type Contacts ¶
type Contacts []*Contact
Contacts is a slice list of contacts
func BodyVelBBoxIntersects ¶
BodyVelBBoxIntersects returns the list of potential contact nodes between a and b (could be the same or different groups) that have intersecting velocity-projected bounding boxes. In general a should be dynamic bodies and b either dynamic or static. This is the broad first-pass filtering.
type Cylinder ¶
type Cylinder struct { BodyBase // height of the cylinder Height float32 // radius of the top -- set to 0 for a cone TopRad float32 // radius of the bottom BotRad float32 }
Cylinder is a generalized cylinder body shape, with separate radii for top and bottom. A cone has a zero radius at one end.
func NewCylinder ¶
NewCylinder adds a new Cylinder with the given name to the given parent: Cylinder is a generalized cylinder body shape, with separate radii for top and bottom. A cone has a zero radius at one end.
func (*Cylinder) NodeType ¶
NodeType returns the *types.Type of Cylinder
func (*Cylinder) SetInitial ¶
SetInitial sets the [Cylinder.Initial]
func (*Cylinder) SetTopRad ¶
SetTopRad sets the [Cylinder.TopRad]: radius of the top -- set to 0 for a cone
type Group ¶
type Group struct {
NodeBase
}
Group is a container of bodies, joints, or other groups it should be used strategically to partition the space and its BBox is used to optimize tree-based collision detection. Use a group for the top-level World node as well.
func NewGroup ¶
NewGroup adds a new Group with the given name to the given parent: Group is a container of bodies, joints, or other groups it should be used strategically to partition the space and its BBox is used to optimize tree-based collision detection. Use a group for the top-level World node as well.
func (*Group) NodeType ¶
NodeType returns the *types.Type of Group
func (*Group) RayBodyIntersections ¶
RayBodyIntersections returns a list of bodies whose bounding box intersects with the given ray, with the point of intersection
func (*Group) SetInitial ¶
SetInitial sets the [Group.Initial]
func (*Group) WorldCollide ¶
WorldCollide does first pass filtering step of collision detection based on separate dynamic vs. dynamic and dynamic vs. static groups. If dynTop is true, then each Dynamic group is separate at the top level -- otherwise they are organized at the next group level. Contacts are organized by dynamic group, when non-nil, for easier processing.
func (*Group) WorldDynGroupBBox ¶
func (gp *Group) WorldDynGroupBBox()
WorldDynGroupBBox does a GroupBBox on all dynamic nodes
func (*Group) WorldInit ¶
func (gp *Group) WorldInit()
WorldInit does the full tree InitAbs and GroupBBox updates
func (*Group) WorldRelToAbs ¶
func (gp *Group) WorldRelToAbs()
WorldRelToAbs does a full RelToAbs update for all Dynamic groups, for Scripted mode updates with manual updating of Rel values.
type Node ¶
type Node interface { tree.Node // AsNodeBase returns a generic NodeBase for our node -- gives generic // access to all the base-level data structures without needing interface methods. AsNodeBase() *NodeBase // AsBody returns a generic Body interface for our node -- nil if not a Body AsBody() Body // IsDynamic returns true if node has Dynamic flag set -- otherwise static // Groups that contain dynamic objects set their dynamic flags. IsDynamic() bool // GroupBBox sets bounding boxes for groups based on groups or bodies. // called in a FuncDownMeLast traversal. GroupBBox() // InitAbs sets current Abs physical state parameters from Initial values // which are local, relative to parent -- is passed the parent (nil = top). // Body nodes should also set their bounding boxes. // Called in a FuncDownMeFirst traversal. InitAbs(par *NodeBase) // RelToAbs updates current world Abs physical state parameters // based on Rel values added to updated Abs values at higher levels. // Abs.LinVel is updated from the resulting change from prior position. // This is useful for manual updating of relative positions (scripted movement). // It is passed the parent (nil = top). // Body nodes should also update their bounding boxes. // Called in a FuncDownMeFirst traversal. RelToAbs(par *NodeBase) // Step computes one update of the world Abs physical state parameters, // using *current* velocities -- add forces prior to calling. // Use this for physics-based state updates. // Body nodes should also update their bounding boxes. Step(step float32) }
Node is the common interface for all nodes
type NodeBase ¶
type NodeBase struct { tree.NodeBase // initial position, orientation, velocity in *local* coordinates (relative to parent) Initial State `view:"inline"` // current relative (local) position, orientation, velocity -- only change these values, as abs values are computed therefrom Rel State `view:"inline"` // current absolute (world) position, orientation, velocity Abs State `set:"-" edit:"-" view:"inline"` // bounding box in world coordinates (aggregated for groups) BBox BBox `set:"-"` }
NodeBase is the basic node, which has position, rotation, velocity and computed bounding boxes, etc. There are only three different kinds of Nodes: Group, Body, and Joint
func NewNodeBase ¶
NewNodeBase adds a new NodeBase with the given name to the given parent: NodeBase is the basic node, which has position, rotation, velocity and computed bounding boxes, etc. There are only three different kinds of Nodes: Group, Body, and Joint
func (*NodeBase) AsNodeBase ¶
func (*NodeBase) InitAbsBase ¶
InitAbsBase is the base-level version of InitAbs -- most nodes call this. InitAbs sets current Abs physical state parameters from Initial values which are local, relative to parent -- is passed the parent (nil = top). Body nodes should also set their bounding boxes. Called in a FuncDownMeFirst traversal.
func (*NodeBase) NodeType ¶
NodeType returns the *types.Type of NodeBase
func (*NodeBase) RelToAbsBase ¶
RelToAbsBase is the base-level version of RelToAbs -- most nodes call this. note: Group WorldRelToAbs ensures only called on Dynamic nodes. RelToAbs updates current world Abs physical state parameters based on Rel values added to updated Abs values at higher levels. Abs.LinVel is updated from the resulting change from prior position. This is useful for manual updating of relative positions (scripted movement). It is passed the parent (nil = top). Body nodes should also update their bounding boxes. Called in a FuncDownMeFirst traversal.
func (*NodeBase) SetInitAngVel ¶
SetInitAngVel sets the initial angular velocity
func (*NodeBase) SetInitLinVel ¶
SetInitLinVel sets the initial linear velocity
func (*NodeBase) SetInitPos ¶
SetInitPos sets the initial position
func (*NodeBase) SetInitQuat ¶
SetInitQuat sets the initial rotation as a Quaternion
func (*NodeBase) SetInitial ¶
SetInitial sets the [NodeBase.Initial]: initial position, orientation, velocity in *local* coordinates (relative to parent)
func (*NodeBase) SetRel ¶
SetRel sets the [NodeBase.Rel]: current relative (local) position, orientation, velocity -- only change these values, as abs values are computed therefrom
func (*NodeBase) StepBase ¶
StepBase is base-level version of Step -- most nodes call this. note: Group WorldRelToAbs ensures only called on Dynamic nodes. Computes one update of the world Abs physical state parameters, using *current* velocities -- add forces prior to calling. Use this for physics-based state updates. Body nodes should also update their bounding boxes.
type NodeFlags ¶
NodeFlags define node bitflags -- uses ki Flags field (64 bit capacity)
const ( // Dynamic means that this node can move -- if not so marked, it is // a Static node. Any top-level group that is not Dynamic is immediately // pruned from further consideration, so top-level groups should be // separated into Dynamic and Static nodes at the start. Dynamic NodeFlags = NodeFlags(tree.FlagsN) + iota )
const NodeFlagsN NodeFlags = 2
NodeFlagsN is the highest valid value for type NodeFlags, plus one.
func NodeFlagsValues ¶
func NodeFlagsValues() []NodeFlags
NodeFlagsValues returns all possible values for the type NodeFlags.
func (NodeFlags) BitIndexString ¶
BitIndexString returns the string representation of this NodeFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (NodeFlags) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*NodeFlags) SetFlag ¶
SetFlag sets the value of the given flags in these flags to the given value.
func (*NodeFlags) SetString ¶
SetString sets the NodeFlags value from its string representation, and returns an error if the string is invalid.
func (*NodeFlags) SetStringOr ¶
SetStringOr sets the NodeFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (*NodeFlags) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Rigid ¶
type Rigid struct { // 1/mass -- 0 for no mass InvMass float32 // COR or coefficient of restitution -- how elastic is the collision i.e., final velocity / initial velocity Bounce float32 `min:"0" max:"1"` // friction coefficient -- how much friction is generated by transverse motion Friction float32 // record of computed force vector from last iteration Force math32.Vector3 // Last calculated rotational inertia matrix in local coords RotInertia math32.Matrix3 }
Rigid contains the full specification of a given object's basic physics properties including position, orientation, velocity. These
type Sphere ¶
Sphere is a spherical body shape.
func NewSphere ¶
NewSphere adds a new Sphere with the given name to the given parent: Sphere is a spherical body shape.
func (*Sphere) NodeType ¶
NodeType returns the *types.Type of Sphere
func (*Sphere) SetInitial ¶
SetInitial sets the [Sphere.Initial]
type State ¶
type State struct { // position of center of mass of object Pos math32.Vector3 // rotation specified as a Quat Quat math32.Quat // linear velocity LinVel math32.Vector3 // angular velocity AngVel math32.Vector3 }
State contains the basic physical state including position, orientation, velocity. These are only the values that can be either relative or absolute -- other physical state values such as Mass should go in Rigid.
func (*State) Defaults ¶
func (ps *State) Defaults()
Defaults sets defaults only if current values are nil
func (*State) EulerRotation ¶
EulerRotation returns the current rotation in Euler angles (degrees).
func (*State) EulerRotationRad ¶
EulerRotationRad returns the current rotation in Euler angles (radians).
func (*State) Move ¶
Move moves (translates) Pos by given amount, and sets the LinVel to the given delta -- this can be useful for Scripted motion to track movement.
func (*State) MoveOnAxis ¶
MoveOnAxis moves (translates) the specified distance on the specified local axis, relative to the current rotation orientation. The axis is normalized prior to aplying the distance factor. Sets the LinVel to motion vector.
func (*State) MoveOnAxisAbs ¶
MoveOnAxisAbs moves (translates) the specified distance on the specified local axis, in absolute X,Y,Z coordinates (does not apply the Quat rotation factor. The axis is normalized prior to aplying the distance factor. Sets the LinVel to motion vector.
func (*State) RotateEuler ¶
RotateEuler rotates by given Euler angles (in degrees) relative to existing rotation.
func (*State) RotateEulerRad ¶
RotateEulerRad rotates by given Euler angles (in radians) relative to existing rotation.
func (*State) RotateOnAxis ¶
RotateOnAxis rotates around the specified local axis the specified angle in degrees.
func (*State) RotateOnAxisRad ¶
RotateOnAxisRad rotates around the specified local axis the specified angle in radians.
func (*State) SetAxisRotation ¶
SetAxisRotation sets rotation from local axis and angle in degrees.
func (*State) SetAxisRotationRad ¶
SetAxisRotationRad sets rotation from local axis and angle in radians.
func (*State) SetEulerRotation ¶
SetEulerRotation sets the rotation in Euler angles (degrees).
func (*State) SetEulerRotationRad ¶
SetEulerRotationRad sets the rotation in Euler angles (radians).
func (*State) StepByAngVel ¶
StepByAngVel steps the Quat rotation from angular velocity
func (*State) StepByLinVel ¶
StepByLinVel steps the Pos from the linear velocity