Table Of Contents

Previous topic

motion.Position

Next topic

motion.util

This Page

motion.Spring

Constructor

class motion.Spring(presence, anchor, stiffness, damping, eqLength, period)

Bases: motion.Acceleration()

Arguments:
  • presence (presence) – The presence to control
  • anchor (util.Vec3|visible|presence) – The anchor point around which the presence oscillates. This can be a vector (point in space) or another presence or visible (which will be examined as its position changes). It can be changed later through <code>controller.anchor</code>.
  • stiffness (number) – The stiffness or “spring constant” of the spring force – the greater the stiffness, the greater the force at the same distance
  • damping (number) – (optional =0) The damping or “friction” of the spring motion
  • eqLength (number) – (optional =0) The equilibrium length of the spring; if positive, the presence will be accelerated away from the anchor point if it gets too close
  • period (number) – (optional =defaultPeriod) The period at which the presence’s velocity is updated

Attributes

anchor

anchor

The anchor position of the spring, or an object with a ‘position’ field that the spring is anchored to.

eqLength

eqLength

The equilibrium length of the spring (units length).

stiffness

stiffness

The stiffness (spring constant, units force/length) of the spring.