class
Rosegold::Physics
- Rosegold::Physics
- Reference
- Object
Overview
Updates the player feet/look/velocity/on_ground by sending movement packets.
Defined in:
rosegold/control/physics.crConstant Summary
-
AIR_SLIP =
1.0
-
BASE_MOVEMENT_SPEED =
0.1
-
BLUE_ICE_SLIP =
0.989
-
DEFAULT_SLIP =
0.6
-
Block slipperiness values
-
DRAG =
0.98
-
FRICTION_CONSTANT =
0.21600002
-
GRAVITY =
0.08
-
ICE_SLIP =
0.98
-
JUMP_FORCE =
0.42
-
MOVEMENT_PACKET_KEEP_ALIVE_INTERVAL =
20
-
Send a keep-alive movement packet every 20 ticks (1 second) even when stationary This prevents server timeouts while avoiding packet spam
-
SLIME_SLIP =
0.8
-
SNEAK_MULTIPLIER =
0.3
-
SPRINT_MULTIPLIER =
1.3
-
VERY_CLOSE =
0.1
Constructors
Class Method Summary
-
.get_grown_obstacles(start : Vec3d, movement : Vec3d, entity_aabb : AABBf, dimension : Dimension) : Array(AABBd)
Returns all block collision boxes that may intersect
entity_aabb
during the movement fromstart
byvec
, including boxes 0.5m higher for stepping. -
.predict_movement_collision(start : Vec3d, velocity : Vec3d, entity_aabb : AABBf, dimension : Dimension)
Applies collision handling including stepping.
-
.predict_movement_collision(start : Vec3d, velocity : Vec3d, obstacles : Array(AABBd))
Applies collision handling including stepping.
Instance Method Summary
- #block_slip : Float64
- #handle_disconnect
- #handle_reset
- #jump_queued=(jump_queued : Bool)
- #jump_queued? : Bool
-
#last_sent_feet : Vec3d
Movement packet rate limiting
-
#last_sent_feet=(last_sent_feet : Vec3d)
Movement packet rate limiting
- #last_sent_look : Look
- #last_sent_look=(last_sent_look : Look)
- #last_sent_on_ground : Bool
- #last_sent_on_ground=(last_sent_on_ground : Bool)
- #look=(target : Look)
- #look_target
-
#move(target : Vec3d | Nil, stuck_timeout_ticks : Int32 = 10)
Set the movement target location and wait until it is achieved.
- #movement_target
- #pause
- #paused=(paused : Bool)
- #paused? : Bool
- #reset_jump_delay
- #running?
- #sneak(sneaking = true)
- #sprint(sprinting = true)
- #tick(virtual_input : Rosegold::VirtualInput | Nil = nil)
- #unpause_for_spawn_chunk
- #very_close_to?(target : Vec3d)
Constructor Detail
Class Method Detail
Returns all block collision boxes that may intersect entity_aabb
during the movement from start
by vec
,
including boxes 0.5m higher for stepping.
entity_aabb
is at 0,0,0; the returned AABBs are grown by entity_aabb
so collision checks are just raytracing.
Applies collision handling including stepping. Returns adjusted movement vector and adjusted post-movement velocity.
Applies collision handling including stepping. Returns adjusted movement vector and adjusted post-movement velocity.
Instance Method Detail
Set the movement target location and wait until it is achieved.
If there is already a movement target, it is cancelled, and replaced with this new target.
Set target=nil
to stop moving and cancel any current movement.
stuck_timeout_ticks
specifies how many consecutive stuck ticks before throwing MovementStuck.