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 -
EPSILON_COLLISION =
1.0e-7 -
Epsilon constants for floating point precision
-
EPSILON_HORIZONTAL =
0.003 -
EPSILON_MOVEMENT =
1.0e-6 -
EPSILON_STUCK =
0.001 -
FRICTION_CONSTANT =
0.21600002 -
GRAVITY =
0.08 -
ICE_SLIP =
0.98 -
JUMP_FORCE =
0.42 -
MAX_UP_STEP =
0.6 -
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 -
WATER_DRAG =
0.8 -
WATER_GRAVITY =
0.005 -
WATER_SWIM_UP_SPEED =
0.04
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_aabbduring the movement fromstartbyvec. - .maybe_back_off_from_edge(feet : Vec3d, velocity : Vec3d, entity_aabb : AABBf, &would_fall : AABBd -> Bool) : Vec3d
-
.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
- #apply_manual_input(input : ManualControl::Input)
- #block_slip : Float64
-
#cancel_goals
Cancels scripted movement and look goals, waking their waiters.
-
#cancel_look
Cancels a pending scripted look, waking its waiter without applying it.
-
#clear_input
Synchronously clears desired keys, queued jump and requested sprint, with no packets, events or yields.
- #handle_disconnect
- #handle_reset
- #jump_queued=(jump_queued : Bool)
- #jump_queued? : Bool
- #keys : MovementKeys
-
#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)
Applies target on a later tick and waits for it.
- #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
- #pending_velocity=(velocity : Vec3d)
-
#reset_input_locally
Clears input state without packets or events, for a closing connection.
- #reset_jump_delay
- #running?
- #sneak(sneaking = true)
- #sprint(sprinting : Bool = true)
- #stop_moving
- #tick
- #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.
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
Cancels a pending scripted look, waking its waiter without applying it. Lock-free because a session reset runs on the packet reader, which must not wait for the action mutex.
Synchronously clears desired keys, queued jump and requested sprint, with no packets, events or yields. Sneak and sprint state changes reach the server on the next tick, which re-applies the neutral manual input.
Applies target on a later tick and waits for it. A manual grant or session reset before the frame carrying the look is written ends the wait without applying the look.
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.