more tweaks to ledge grab, still too hard to start the ledge grab

This commit is contained in:
derek
2025-06-17 11:59:09 -05:00
parent b13a67fa31
commit 8220db9a57
5 changed files with 38 additions and 6 deletions

View File

@@ -142,6 +142,8 @@ var controlled_elsewhere = false
@onready var clamber_max_ray: RayCast3D = $ClamberMaxRay
@onready var clamber_check_ray: RayCast3D = $ClamberCheckRay
@onready var clamber_point_ray: RayCast3D = $ClamberPointRay
@onready var ledge_l_ray: RayCast3D = $LedgeLRay
@onready var ledge_r_ray: RayCast3D = $LedgeRRay
func _ready():
level_control.player = self

View File

@@ -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

View File

@@ -4,7 +4,7 @@ class_name PlayerGroundPound
@export var ground_pound_velocity = -35
func Enter():
character.velocity += Vector3(0,ground_pound_velocity,0)
character.velocity = Vector3(0,ground_pound_velocity,0)
func Physics_Update(delta):
if character.is_on_floor():