VoxelBody class
An AABB anchored at the feet, swept against the block volume one axis at a time. Knows nothing of rendering: a game moves its visuals from position.
Constructors
Properties
- feetLiquid ↔ int
-
The liquid kind at the feet cell, or VoxelBlockDef.noLiquid.
getter/setter pair
- fenceBarrier ↔ bool
-
Fences stand fenceBarrierHeight tall to this body, above its jump: an
animal stays in its pen. Off, a fence is the one block it is drawn as.
getter/setter pair
- gravity ↔ double
-
Downward acceleration in air, cells per second squared.
getter/setter pair
- halfWidth ↔ double
-
Half the box's width on x and on z.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- headInLiquid ↔ bool
-
The head cell holds a liquid.
getter/setter pair
- headLiquid ↔ int
-
The liquid kind at the head cell, or VoxelBlockDef.noLiquid.
getter/setter pair
- height ↔ double
-
The box's height above position.
getter/setter pair
- hitWall ↔ bool
-
The last move was stopped on x or z.
getter/setter pair
- inLiquid ↔ bool
-
In any liquid, at the feet or the head.
getter/setter pair
- liquidGravity ↔ double
-
Downward acceleration in a liquid; the sink speed there is capped at 3.
getter/setter pair
- noclip ↔ bool
-
A ghost passes through every block.
getter/setter pair
- onFloor ↔ bool
-
The last move ended standing on something.
getter/setter pair
- position ↔ Vector3
-
The middle of the body's feet, in world cells.
getter/setter pair
- query ↔ VoxelQuery
-
The world the body moves in; set by setup.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- velocity ↔ Vector3
-
Cells per second, applied by move.
getter/setter pair
- wading → bool
-
Standing on the floor with the head in the open: the body wades through a
shallow liquid instead of swimming in it. A one-block puddle is walked;
only water deep enough to cover the head is swum.
no setter
Methods
-
applyGravity(
double dt) → void -
Accelerates velocity down for
dtseconds: gravity in air and while wading, liquidGravity in a liquid deep enough to swim in, with the sink speed capped at 3. -
centre(
) → Vector3 - The middle of the box.
-
move(
double dt) → void -
Moves by velocity for
dtseconds, x then z then y, stopping flush against every collision box. Updates onFloor, hitWall and the liquid senses; a blocked axis loses its velocity. noclip skips the collisions. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overlapsBlock(
IVec3 b) → bool - Cube-based on purpose: callers ask "is the body in this CELL" (a block about to be placed, a door), which does not depend on the block's shape.
-
rayDistance(
Vector3 origin, Vector3 direction, [double inflate = 0.0]) → double -
The ray parameter at which the ray enters the body's box grown by
inflateon every side: 0 whenoriginis inside, -1 when it misses. -
setup(
VoxelQuery q, double hw, double h) → void -
Places the body in world
qwith half widthhwand heighth. Call before the first move. -
stepAhead(
{bool fullBlock = true}) → double - The step the body just walked into — halfStep, fullStep or 0 when there is none to climb. Nothing is ever lifted into place: a body that meets a step jumps it, which is what this answers for. The body is also tested a hair further in the blocked direction, so a half step never wins against a full-height wall.
-
stepFits(
double lift) → bool -
Would the body, lifted by
liftand nudged a hair toward the wall it just hit, stand clear of every block? stepAhead asks it of each step height; a swimmer climbing a bank asks it of every lift that would clear the lip. -
toString(
) → String -
A string representation of this object.
inherited
-
wallAhead(
Vector3 direction) → bool - Is there a solid block directly in front (for climbing)? Cube-based on purpose: climbing reads the cell, the shape inside it does not matter. The lowest probe is the feet cell itself: a probe above the feet loses the wall while the feet are still below its top, and a climber stalls there, falling back and climbing again, instead of reaching the top.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited