net.nexttext.behaviour.physics
Class Bounce

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

public class Bounce
extends PhysicsAction

This action performs collision response on two objects by moving them apart and reflects their velocity.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.nexttext.behaviour.Action
Action.ActionResult
 
Constructor Summary
Bounce(float elasticity, float absorbEnergy)
           
 
Method Summary
 Action.ActionResult behave(TextObject toA, TextObject toB)
          Performs collision response on toA and toB by pushing them apart an reflecting their velocity.
 
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

Bounce

public Bounce(float elasticity,
              float absorbEnergy)
Parameters:
elasticity - The elasticity of collision
absorbEnergy - Objects absorb energy from each other if non zero
Method Detail

behave

public Action.ActionResult behave(TextObject toA,
                                  TextObject toB)
Performs collision response on toA and toB by pushing them apart an reflecting their velocity.

Objects will not collide if one is a child of the other.

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