public abstract class Collision extends java.lang.Object implements java.lang.Comparable<Collision>
Modifier and Type | Field and Description |
---|---|
double |
timeInFrame |
Constructor and Description |
---|
Collision()
Obliatory super call
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Collision o)
At insertion into a
SortedSet of collisions, duplicates are ignored. |
static java.util.Collection<Collision> |
discoverCollisions(java.util.List<MotionTargetPanzer> panzerTargets,
java.util.List<MotionTargetLaunchable> projectileTargets,
java.util.List<Droppable> droppables,
SimulationMode simulationMode)
Within the given objects, collisions are to be discovered.
|
double |
getTimeInFrame() |
abstract void |
react(SimulationState state,
java.util.List<MotionTargetPanzer> panzerTargets,
SimulationMode simulationMode)
Performs collision effects.
|
java.util.Collection<Collision> |
rediscoverCollisions(java.util.Collection<Collision> collisions,
java.util.ArrayList<MotionTargetPanzer> panzerTargets,
java.util.ArrayList<MotionTargetLaunchable> projectileTargets)
Once a collision response has taken place, the detected collisions with
the two partners are no longer valid.
|
public int compareTo(Collision o)
SortedSet
of collisions, duplicates are ignored.
By default, collisions are not treated as duplicates. But any implementing collision class can override the routine and thus define duplicates itself.
compareTo
in interface java.lang.Comparable<Collision>
Comparable.compareTo(Object)
public static java.util.Collection<Collision> discoverCollisions(java.util.List<MotionTargetPanzer> panzerTargets, java.util.List<MotionTargetLaunchable> projectileTargets, java.util.List<Droppable> droppables, SimulationMode simulationMode)
Comparator
is of
central relevance.panzerTargets
- projectileTargets
- simulationMode
- - for hooking into collision detectionpublic double getTimeInFrame()
public abstract void react(SimulationState state, java.util.List<MotionTargetPanzer> panzerTargets, SimulationMode simulationMode)
state
- SimulationState
to manipulatepanzerTargets
- If forces are exerted, the motion targets must be updatedsimulationMode
- - used for specific motion related effectspublic java.util.Collection<Collision> rediscoverCollisions(java.util.Collection<Collision> collisions, java.util.ArrayList<MotionTargetPanzer> panzerTargets, java.util.ArrayList<MotionTargetLaunchable> projectileTargets)
At this moment of development, no collision rediscovery is
implemented. The portion of affected collisions is estimated by around
one to a hundred. This is why a test for correctness is difficult in
the given time at the moment.
If time is found for an implementation, follow the comments in the
code. The routine is already used, so changes will take effect.
collisions
- panzerTargets
- projectileTargets
-