more tweaks to ledge grab, still too hard to start the ledge grab
This commit is contained in:
@@ -3,13 +3,17 @@ class_name PlayerClamber
|
||||
|
||||
var clamber_point
|
||||
|
||||
const CLAMBER_Y_OFFSET = .4
|
||||
|
||||
func Enter():
|
||||
clamber_point = character.get_clamber_point()
|
||||
character.velocity = Vector3.ZERO
|
||||
|
||||
func Physics_Update(delta):
|
||||
character.velocity = Vector3.ZERO
|
||||
character.global_position.y = lerp(character.global_position.y,clamber_point.y - CLAMBER_Y_OFFSET,delta * 2)
|
||||
|
||||
character.global_position.y = lerp(character.global_position.y,clamber_point.y,delta * 2)
|
||||
if !is_still_on_ledge():
|
||||
Transitioned.emit(self,"in air")
|
||||
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
jump_with_weight_mod()
|
||||
@@ -17,3 +21,21 @@ func Physics_Update(delta):
|
||||
|
||||
if Input.is_action_just_pressed("crouch"):
|
||||
Transitioned.emit(self,"in air")
|
||||
|
||||
ledge_movement(delta)
|
||||
|
||||
func is_still_on_ledge():
|
||||
if character.clamber_point_ray.is_colliding():
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
|
||||
func ledge_movement(delta):
|
||||
var direction = character.movement_input()
|
||||
character.velocity.x = lerp(character.velocity.x,direction.x * move_speed,delta * move_transition_speed)
|
||||
#if direction.x < 0:
|
||||
#if character.ledge_l_ray.is_colliding():
|
||||
#character.velocity.x += direction.x * delta * move_speed
|
||||
#if direction.x > 0:
|
||||
#if character.ledge_r_ray.is_colliding():
|
||||
#character.velocity.x += direction.x * delta * move_speed
|
||||
|
||||
Reference in New Issue
Block a user