net.nexttext.behaviour.physics
Class PhysicsAction

java.lang.Object
  extended by net.nexttext.behaviour.AbstractAction
      extended by net.nexttext.behaviour.physics.PhysicsAction
All Implemented Interfaces:
Action
Direct Known Subclasses:
Approach, Bounce, Explode, Gravity, Move, Push, Spin, StayInside, StayInWindow, Stop

public abstract class PhysicsAction
extends AbstractAction

Every Action in this package should be a descendant of this class.

PhysicsAction introduces a new set of physics properties, and provide the usual accessors for them.

Properties to add in the future include elasticity and mass. A method to get absolute velocity may also be useful.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.nexttext.behaviour.Action
Action.ActionResult
 
Constructor Summary
PhysicsAction()
           
 
Method Summary
 void applyAcceleration(TextObject to, processing.core.PVector acceleration)
          Applies an acceleration to a TextObject.
 void applyAngularAcceleration(TextObject to, float angAcc)
          Applies an angular acceleration to a TextObject.
 void applyAngularForce(TextObject to, float angularForce)
          Applies an angular force (torque) to a TextObject.
 void applyForce(TextObject to, processing.core.PVector force)
          Applies a force to a TextObject.
 NumberProperty getAngularVelocity(TextObject to)
           
 NumberProperty getMass(TextObject to)
           
 java.util.Map<java.lang.String,Property> getRequiredProperties()
          Returns a Map containing a set of Vector3Properties required by all PhysicActions
 PVectorProperty getVelocity(TextObject to)
           
 
Methods inherited from class net.nexttext.behaviour.AbstractAction
behave, 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

PhysicsAction

public PhysicsAction()
Method Detail

getRequiredProperties

public java.util.Map<java.lang.String,Property> getRequiredProperties()
Returns a Map containing a set of Vector3Properties required by all PhysicActions

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

getMass

public NumberProperty getMass(TextObject to)

getVelocity

public PVectorProperty getVelocity(TextObject to)

getAngularVelocity

public NumberProperty getAngularVelocity(TextObject to)

applyForce

public void applyForce(TextObject to,
                       processing.core.PVector force)
Applies a force to a TextObject.

The mass of the object will affect the resulting acceleration.


applyAcceleration

public void applyAcceleration(TextObject to,
                              processing.core.PVector acceleration)
Applies an acceleration to a TextObject.

This acceleration is independent of the mass of the object.


applyAngularForce

public void applyAngularForce(TextObject to,
                              float angularForce)
Applies an angular force (torque) to a TextObject.

The mass of the object will affect the resulting angular acceleration.


applyAngularAcceleration

public void applyAngularAcceleration(TextObject to,
                                     float angAcc)
Applies an angular acceleration to a TextObject.

This acceleration is independent of the mass of the object.