hermes.physics
Class GenericMassedCollider<A extends MassedBeing,B extends MassedBeing>

java.lang.Object
  extended by hermes.Interactor<A,B>
      extended by hermes.physics.GenericMassedCollider<A,B>
Type Parameters:
A - the first type of MassedBeing
B - the second type of MassedBeing
Direct Known Subclasses:
MassedCollider

public class GenericMassedCollider<A extends MassedBeing,B extends MassedBeing>
extends Interactor<A,B>

This is a collision handler for MassedBeing and its subclasses which handles collisions using both projection (instantly separating the bodies) and impulse (changing their velocities).

Use GenericMassedCollider, as opposed to MassedCollider, only if you intend to override the behavior and methods specific to a subclass of MassedBeing.


Constructor Summary
GenericMassedCollider()
           Default MassedCollider constructor.
GenericMassedCollider(float elasticity)
          Creates a MassedCollider with specified collision elasticity.
 
Method Summary
 boolean detect(A being1, B being2)
          Determines whether an interaction between two objects has occurred.
 void handle(A being1, B being2)
          Handles the result of an interaction that has been detected (by detect return true) for a pair of objects.
 
Methods inherited from class hermes.Interactor
appliedImmediately, multisampled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericMassedCollider

public GenericMassedCollider()

Default MassedCollider constructor. In this case, collision elasticity will be the average of the colliding being elasticities.


GenericMassedCollider

public GenericMassedCollider(float elasticity)
Creates a MassedCollider with specified collision elasticity.

Parameters:
elasticity - collision elasticity
Method Detail

detect

public boolean detect(A being1,
                      B being2)
Description copied from class: Interactor
Determines whether an interaction between two objects has occurred.

Specified by:
detect in class Interactor<A extends MassedBeing,B extends MassedBeing>
Parameters:
being1 - the first interacting object
being2 - the second interacting object
Returns:
Whether or not an interaction has occurred.

handle

public void handle(A being1,
                   B being2)
Description copied from class: Interactor
Handles the result of an interaction that has been detected (by detect return true) for a pair of objects.

Specified by:
handle in class Interactor<A extends MassedBeing,B extends MassedBeing>
Parameters:
being1 - the first object
being2 - the second object