net.nexttext.behaviour.physics
Class Move

java.lang.Object
  extended by net.nexttext.behaviour.AbstractAction
      extended by net.nexttext.behaviour.physics.PhysicsAction
          extended by net.nexttext.behaviour.physics.Move
All Implemented Interfaces:
Action

public class Move
extends PhysicsAction

This is the basic Move; actions from the physics package will have no effect unless this behaviour is applied to objects.

It implements basic mechanics, updating position and velocity, rotation, and angular velocity, based on force, angular force (torque), and mass. On each frame the force and angular force are reset to zero. In addition, each Move has its own drag coefficient, which is applied to every object's velocity on each frame.

Physics actions will typically add to the force on an object on each frame.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.nexttext.behaviour.Action
Action.ActionResult
 
Constructor Summary
Move()
           
Move(float drag, float angularDrag)
          New Move action with specified drag.
 
Method Summary
 Action.ActionResult behave(TextObject to)
          Applies Euler motion to a TextObject.
 
Methods inherited from class net.nexttext.behaviour.physics.PhysicsAction
applyAcceleration, applyAngularAcceleration, applyAngularForce, applyForce, getAngularVelocity, getMass, getRequiredProperties, getVelocity
 
Methods inherited from class net.nexttext.behaviour.AbstractAction
behave, behave, complete, getDisplayName, makeBehaviour, properties, setDisplayName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Move

public Move()

Move

public Move(float drag,
            float angularDrag)
New Move action with specified drag.

Drag is a fraction of the velocity by which it will be scaled back. So a drag of 1 will cause objects to halt completely, and 0 will have no effect.

Method Detail

behave

public Action.ActionResult behave(TextObject to)
Applies Euler motion to a TextObject.

Specified by:
behave in interface Action
Overrides:
behave in class AbstractAction