add float
This commit is contained in:
parent
5782bbc2c3
commit
22ac0db4aa
Binary file not shown.
|
@ -5,6 +5,7 @@ onready var util = get_node("/root/Util")
|
|||
export var gravity: float = 6.0
|
||||
# When falling, gravity is artificially increased
|
||||
export var gravity_downwards_factor: float = 3
|
||||
export var float_factor = 0.5
|
||||
export var ground_gravity: float = 3.1
|
||||
# Rate of gaining speed
|
||||
export var velocity_acceleration_xz: float = 3
|
||||
|
@ -19,6 +20,7 @@ export var sprint_factor: float = 3.5
|
|||
export var walk_factor: float = 2.0
|
||||
|
||||
export var can_glide: bool = false
|
||||
export var can_float: bool = false
|
||||
|
||||
"public" var velocity: Vector3 = Vector3.ZERO
|
||||
# Value changed by code only to add slow down or speed up effects
|
||||
|
@ -52,7 +54,10 @@ func process_velocity(delta: float):
|
|||
grav /= 4
|
||||
target_velocity.y = grav
|
||||
# Gravity is stronger when you're falling. Feels nicer
|
||||
target_velocity.y *= util.clamped_lerp(gravity_downwards_factor, 1.0, velocity.y/2, 0.0)
|
||||
var gdf = gravity_downwards_factor
|
||||
if can_float and Input.is_action_pressed("player_jump"):
|
||||
gdf = float_factor
|
||||
target_velocity.y *= util.clamped_lerp(gdf, 1.0, velocity.y/2, 0.0)
|
||||
else:
|
||||
velocity.y = max(0.0, velocity.y)
|
||||
target_velocity.y = max(0.0, max(target_velocity.y, jump_power * $"../MovementInput".jump_intent * jump_permission))
|
||||
|
|
|
@ -3,6 +3,8 @@ extends Spatial
|
|||
onready var active_physics_node: Spatial = $OnFootPhysics
|
||||
|
||||
export var can_glide: bool = false
|
||||
export var can_float: bool = false
|
||||
export var float_factor = 0.5
|
||||
|
||||
func _ready():
|
||||
Util.player = self
|
||||
|
@ -35,4 +37,7 @@ func objective_distance() -> float:
|
|||
|
||||
func _process(_delta):
|
||||
$OnFootPhysics.can_glide = can_glide
|
||||
$OnFootPhysics.can_float = can_float
|
||||
$OnFootPhysics.float_factor = float_factor
|
||||
|
||||
|
||||
|
|
|
@ -244,4 +244,7 @@ common/enable_pause_aware_picking=true
|
|||
|
||||
[rendering]
|
||||
|
||||
quality/filters/msaa=4
|
||||
quality/filters/use_fxaa=true
|
||||
quality/filters/use_debanding=true
|
||||
environment/default_environment="res://default_env.tres"
|
||||
|
|
Loading…
Reference in New Issue