Added a simpler 'static' jump pose, and implemented in AnimTree
This commit is contained in:
+5
-1
@@ -29,16 +29,19 @@ func map( value : float , in_min : float, in_max : float, out_min : float, out_m
|
||||
func update_tree():
|
||||
anim_tree["parameters/Walk/blend_amount"] = animp.speed_scale / 1.5
|
||||
anim_tree["parameters/Run/blend_amount"] = map ( speed , SPEED , SPEED * RUN_MULT , 0 , 1 )
|
||||
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity.y -= gravity * delta
|
||||
else:
|
||||
anim_tree["parameters/Jump/blend_amount"] = move_toward( anim_tree["parameters/Jump/blend_amount"] , 0.0 , 0.1)
|
||||
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("jump") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
anim_tree["parameters/Jump/blend_amount"] = 1.0
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
@@ -71,6 +74,7 @@ func _physics_process(delta):
|
||||
velocity.z = move_toward(velocity.z, 0, INNERTIA )
|
||||
animp.speed_scale = move_toward( animp.speed_scale, 0 , .05 )
|
||||
|
||||
|
||||
$GPUParticles3D.amount_ratio = 0.0
|
||||
update_tree()
|
||||
move_and_slide()
|
||||
|
||||
Reference in New Issue
Block a user