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

@@ -172,6 +172,8 @@ script = ExtResource("7_2asft")
[node name="Ledge Grab" type="Node" parent="StateMachine"]
script = ExtResource("8_iwgew")
move_speed = 1.0
move_transition_speed = 10.0
[node name="On Ladder" type="Node" parent="StateMachine"]
script = ExtResource("8_vgdha")
@@ -377,8 +379,14 @@ target_position = Vector3(0, 0, 1)
[node name="WallJumpTimer" type="Timer" parent="."]
one_shot = true
[node name="LedgeLRay" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 0.969, -0.509)
[node name="LedgeRRay" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0.969, -0.509)
[node name="ClamberMaxRay" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 0, 0.968505, -0.391)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.17686, 0.00231841)
target_position = Vector3(0, 0, -1)
collision_mask = 33
@@ -389,7 +397,7 @@ collision_mask = 33
[node name="ClamberCheckRay" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.607088, -0.279418)
target_position = Vector3(0, 0, -1)
target_position = Vector3(0, 0, -1.5)
collision_mask = 33
hit_back_faces = false

View File

@@ -12,7 +12,7 @@ config_version=5
config/name="First Person Test"
config/tags=PackedStringArray("fps")
run/main_scene="uid://c6fykssf7paft"
run/main_scene="uid://b55ukxds1s7ih"
config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="uid://6svuq1l83al5"

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():