diff --git a/project/assets/character/player/player.blend b/project/assets/character/player/player.blend index acb6dffd..f796cacb 100644 --- a/project/assets/character/player/player.blend +++ b/project/assets/character/player/player.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5bd574f575b88e6de1812e98dbea2cbfd3d9dc0941f1c68b9494a946ac64e74f -size 321553 +oid sha256:682dca80e60e9e3c2cdf136bec2410d8d9dd121db8324d00034f20b2282cce35 +size 313287 diff --git a/project/assets/character/player/player.blend1 b/project/assets/character/player/player.blend1 index 46defa5e..28dd58c8 100644 Binary files a/project/assets/character/player/player.blend1 and b/project/assets/character/player/player.blend1 differ diff --git a/project/objects/player.tscn b/project/objects/player.tscn index dd72dca0..b59b6a55 100644 --- a/project/objects/player.tscn +++ b/project/objects/player.tscn @@ -173,6 +173,7 @@ script/source = "@tool extends RayCast3D @onready var body : PlayerBody = get_owner() as Node3D @export var dist_mul : float +@export var height : float = 1.0 var last_direction : Vector3 = Vector3.BACK func _ready() -> void: @@ -180,7 +181,7 @@ func _ready() -> void: func _physics_process(_delta : float): if Engine.is_editor_hint() and body: - global_position = body.global_position + Vector3.UP + Vector3.BACK * dist_mul + global_position = body.global_position + Vector3.UP * height + Vector3.BACK * dist_mul elif body: var direction : Vector3 = -body.velocity if body.is_on_wall(): @@ -188,7 +189,7 @@ func _physics_process(_delta : float): direction = Vector3(direction.x, 0, direction.z).normalized() if not direction.is_zero_approx(): last_direction = direction - global_position = body.global_position + Vector3.UP + last_direction * dist_mul + global_position = body.global_position + Vector3.UP * height + last_direction * dist_mul " [sub_resource type="GDScript" id="GDScript_3rerk"] @@ -201,7 +202,7 @@ func _ready(): %LedgeHangTimer.timeout.connect(set.bind(\"timeout\", false)) func _enter() -> int: - if not timeout and not body.is_on_floor() and blackboard.hang_ray.is_colliding() and blackboard.hang_ray.get_collision_normal().y > 0.9 and body.is_on_wall(): + if not timeout and blackboard.hang_ray.is_colliding() and blackboard.hang_ray.get_collision_normal().y > 0.9 and body.is_on_wall(): timeout = true return Success else: @@ -217,16 +218,19 @@ var wall_normal : Vector3 func _enter() -> int: blackboard.anim.set(\"parameters/Ledge/request\", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) wall_normal = body.get_wall_normal() - blackboard.character.look_at(blackboard.character.global_position - Vector3(wall_normal.x, 0, wall_normal.z)) + wall_normal = Vector3(wall_normal.x, 0, wall_normal.z).normalized() + blackboard.character.look_at(blackboard.character.global_position - wall_normal) return Running func _execute() -> int: - var diff : Vector3 = blackboard.hang_ray.get_collision_point() - blackboard.hang_ray.global_position - body.velocity = Vector3(body.velocity.x * 0.7, diff.y * 15., body.velocity.z * 0.7) - var input_dot_wall : float = wall_normal.dot(blackboard.get_world_move_input()) - if diff.length() < 0.05 and input_dot_wall < -0.5: - return Success - return Running + if get_status() == Running: + var diff : Vector3 = blackboard.hang_ray.get_collision_point() - blackboard.hang_ray.global_position + body.velocity = Vector3.ZERO + body.global_position = body.global_position.lerp(body.global_position + diff, 0.25) + var input_dot_wall : float = wall_normal.dot(blackboard.get_world_move_input()) + if diff.length() < 0.05 and input_dot_wall < -0.5: + return Success + return get_status() func _exit(): %LedgeHangTimer.start()