RedSpring helper class for RedObject:spring



simple class that keeps track of connections and spring parameters.


see also: RedObject


class methods:

*new(object, target, stiffness, damping, length)

create a new spring object.

object - a RedObject that will be connected to target

target - a RedObject acting as target

stiffness - float.  default 0.1

damping - float.  default 0.9

length - float.  default 0


instance methods:

update

calls the method spring on the object.  see RedObject

update2

calls the method spring on both the object and the target. Note that this is just a convenience method for interconnecting two objects with one spring.

instance variables:

<>object

<>target

<>stiffness

<>damping

<>length



a= RedWorld.new

b= RedObject(a, RedVector2D[0, 0]);

c= RedObject(a, RedVector2D[100, 100]);

d= RedSpring(b, c);


b.accel //no acceleration

d.update //apply spring force

b.accel //now acceleration


//see examples folder