Class SimpleStepChecker
raft.kilavuz.grid.SimpleStepChecker All Implemented Interfaces:
-
public class SimpleStepChecker
a simple step checker implementation based on jPCT.
Field Summary |
|
|
|
ELLIPSOID_COLLISION_FOR_GROUND_CHECKuse ellipsoid based collision (instead of ray casting) to initially check if ground exists under us
this way, more cells at end points of maps (if there is no wall etc) will be included:
cells with center points slightly outside of end points will be included. |
|
NO_GROUNDconstant to indicate no ground is found under a certain point |
|
|
|
|
Constructor Summary |
SimpleStepChecker(World world, float cellWidth, float cellHeight, float stepRatio, float jumpRatio, float fallRatio)creates a SimpleStepChecker with 0.9 as gravityWidthRatio |
SimpleStepChecker(World world, float cellWidth, float cellHeight, float stepRatio, float jumpRatio, float fallRatio, float gravityWidthRatio, boolean useRayCollisionForGroundCheck, boolean useRayCollisionDistanceToGround)creates a SimpleStepChecker |
Field Detail
NO_GROUND
public static final float NO_GROUND
-
constant to indicate no ground is found under a certain point
RAY_COLLISION_FOR_GROUND_CHECK
public static boolean RAY_COLLISION_FOR_GROUND_CHECK
-
use ray based collision (instead of ellipsoid based) to initially check
if ground exists under us
ELLIPSOID_COLLISION_FOR_GROUND_CHECK
public static boolean ELLIPSOID_COLLISION_FOR_GROUND_CHECK
-
use ellipsoid based collision (instead of ray casting) to initially check if ground exists under us
this way, more cells at end points of maps (if there is no wall etc) will be included:
cells with center points slightly outside of end points will be included.
this is default
RAY_COLLISION_FOR_DISTANCE_TO_GROUND
public static boolean RAY_COLLISION_FOR_DISTANCE_TO_GROUND
-
elevation calculation depends on ray casting.
nine rays (one in center and 3 at each sides) are casted towards ground and
highest point is considered as elevation
this is default
ELLIPSOID_COLLISION_FOR_DISTANCE_TO_GROUND
public static boolean ELLIPSOID_COLLISION_FOR_DISTANCE_TO_GROUND
-
elevation calculation depends on ellipsoid collision check.
an ellipsoid is taken down as much as it can.
near to points where a unit can fall dowon or at end points
this may lead to lower elevation then really is.
not suggested especially with ELLIPSOID_COLLISION_FOR_GROUND_CHECK
Constructor Detail
SimpleStepChecker
public SimpleStepChecker(World world, float cellWidth, float cellHeight, float stepRatio, float jumpRatio, float fallRatio) -
creates a SimpleStepChecker with 0.9 as gravityWidthRatio
SimpleStepChecker
public SimpleStepChecker(World world, float cellWidth, float cellHeight, float stepRatio, float jumpRatio, float fallRatio, float gravityWidthRatio, boolean useRayCollisionForGroundCheck, boolean useRayCollisionDistanceToGround) -
creates a SimpleStepChecker
Parameters:
-
cellWidth - cellWidth
-
cellHeight - cellHeight
-
stepRatio - how high a unit can step up, given as a ratio to cellHeight
-
jumpRatio - how high a unit can jump, given as a ratio to cellHeight, 0 to disable jumping
-
fallRatio - how high a unit can step down, given as a ratio to cellHeight, must be et least as stepRatio
-
gravityWidthRatio - while placing unit onto ground, it may help using a slightly narrower
ellipsoid to prevent stuck at walls etc.a value like 0.9 should be fine
-
useRayCollisionForGroundCheck - initiall ground check depends on ray casting
-
useRayCollisionDistanceToGround - elevation calculation depends on ray casting
See Also:
-
Method Detail
canStepTo
-
checks if unit can move in given direction.
Specified by:
-
Parameters:
-
from - the place on ground at current position
-
direction - the direction to move, y value is irrelevant
Returns:
-
step to reach that cell, or null cell is not reachable.
canJumpTo
-
checks if unit can jump in given direction.
Specified by:
-
Parameters:
-
from - the place on ground at current position
-
direction - the direction to move, y value is irrelevant
Returns:
-
step to reach that cell, or null cell is not reachable.
getDistanceToGround
-
returns distance to ground from given top point, or NO_GROUND if there no ground under us.
Parameters:
-
top - location distance will be calculated to
DocFlex/Doclet is both a multi-format Javadoc doclet and a free edition of DocFlex/Javadoc. If you need to customize your Javadoc without writing a full-blown doclet from scratch, DocFlex/Javadoc may be the only tool able to help you! Find out more at www.docflex.com