Motion:
Filter:
3Dj/Classes (extension) | Libraries > 3Dj

Motion
ExtensionExtension

SSObject motion type

Description

Motion provide, through its subclasses, predefined dynamic behaviors to the receiving SSObject instance.

All Motions provide a next method, which is used to compute the next object position.

At the moment, the following motion types are available:

--> \static No predefined motion. This is the default for new SSObject instances, With this behavior, objects can still move by the physical interaction way (for instance, SSObject: -vel or SSObject: -accel).

--> \rect Rectilinear motion. It takes as argument an Array with the initial velocity in each axis. Physical model actions can still interact with the object. With rectilinear motion, objects can also still interact in the physical way.

--> \random Random motion. Performs a series of rectilinear motions with random velocity and acceleration.

It takes two arguments: the maximum value for the random velocity and acceleration vectors (default to 1), and the period (in s) of parameter recalculation (default to world.timeStep).

--> \brown Brownian motion. Based on Pbrown.

It receives as an argument the amount of position variation of each step, in reference to the world's dimension. Default to 0.01 (1% of the world size).

More in http://en.wikipedia.org/wiki/Brownian_motion

--> \shm Simple Harmonic Motion (http://en.wikipedia.org/wiki/Simple_harmonic_motion) in each of the three axis, resulting in a composite motion.

It takes two arguments; first one is an array [xAmp,yAmp,zAmp] with the amplitudes (in m) in each axis. Default to [1,1,1]. Second argument is the motion period, in seconds. Default to [1,1,1].

\orbit Orbital motion in the horizontal plane. The arguments are the angular velocity (in m/s), and the rotation direction (either \dex for dextrorotatory, or \lev for levorotatory).

Class Methods

.new

Usually, motion creation is called internally from inside SSObject: -setMotion method.

Arguments:

object

Receiving SSObject

Instance Methods

.initMotion

.type

Get motion type

.object

Get object receiver

.next

.step

The object's SSWorld stepFreq