class Rosegold::Physics

Overview

Updates the player feet/look/velocity/on_ground by sending movement packets.

Defined in:

rosegold/control/physics.cr

Constant Summary

DRAG = 0.98
GRAVITY = 0.08
JUMP_FORCE = 0.42
SNEAK_SPEED = 1.31 / 20
SPRINT_SPEED = 5.612 / 20
VERY_CLOSE = 0.00001
WALK_SPEED = 4.3 / 20

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(client : Rosegold::Client) #

[View source]

Class Method Detail

def self.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 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.


[View source]
def self.predict_movement_collision(start : Vec3d, velocity : Vec3d, entity_aabb : AABBf, dimension : Dimension) #

Applies collision handling including stepping. Returns adjusted movement vector and adjusted post-movement velocity.


[View source]
def self.predict_movement_collision(start : Vec3d, velocity : Vec3d, obstacles : Array(AABBd)) #

Applies collision handling including stepping. Returns adjusted movement vector and adjusted post-movement velocity.


[View source]

Instance Method Detail

def handle_disconnect #

[View source]
def handle_reset #

[View source]
def jump_queued=(jump_queued : Bool) #

[View source]
def jump_queued? : Bool #

[View source]
def look=(target : Look) #

Set the look target and wait until it is achieved. If there is already a look target, it is cancelled, and replaced with this new target.


[View source]
def look_target #

[View source]
def move(target : Vec3d | Nil) #

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.


[View source]
def movement_speed : Float64 #

[View source]
def movement_target #

[View source]
def pause #

[View source]
def paused=(paused : Bool) #

[View source]
def paused? : Bool #

[View source]
def sneak(sneaking = true) #

[View source]
def sprint(sprinting = true) #

[View source]
def tick #

[View source]
def very_close_to?(target : Vec3d) #

[View source]