mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
add on_player_set entity component event
This commit is contained in:
parent
8d7fab1f2f
commit
e4a11f182e
9 changed files with 29 additions and 15 deletions
|
|
@ -142,14 +142,16 @@ end
|
|||
|
||||
function is_flight() return flight end
|
||||
|
||||
function set_flight(flag) flight = flag end
|
||||
function set_flight(flag)
|
||||
flight = flag
|
||||
body:set_gravity_scale(flight and 0.0 or props.gravity_scale)
|
||||
end
|
||||
|
||||
local prev_angle = (vec2.angle({dir[3], dir[1]})) % 360
|
||||
|
||||
function on_physics_update(delta)
|
||||
local grounded = body:is_grounded()
|
||||
body:set_vdamping(flight)
|
||||
body:set_gravity_scale(flight and 0.0 or props.gravity_scale)
|
||||
body:set_linear_damping(
|
||||
(flight or not grounded) and props.air_damping or props.ground_damping
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue