ani fixed
This commit is contained in:
@@ -42,6 +42,7 @@ var is_grapple_shooting: bool = false
|
||||
|
||||
# ── State tracking ────────────────────────────────────────────────────────────
|
||||
var wall_normal: Vector3 = Vector3.ZERO
|
||||
var wall_contact_point: Vector3 = Vector3.ZERO
|
||||
var wall_side: float = 0.0 # -1 left, +1 right, 0 none
|
||||
var on_ground: bool = false
|
||||
var last_ground_time: float = 0.0
|
||||
@@ -268,6 +269,7 @@ func detect_wall_horizontal() -> Vector3:
|
||||
# Wall must be roughly vertical (normal mostly horizontal)
|
||||
if abs(n.y) < 0.3 and n.length_squared() > 0.0:
|
||||
wall_normal = n.normalized()
|
||||
wall_contact_point = hit.get("position", origin)
|
||||
wall_side = side_data["side"]
|
||||
return wall_normal
|
||||
|
||||
@@ -288,10 +290,12 @@ func detect_wall_horizontal() -> Vector3:
|
||||
var n: Vector3 = hit.get("normal", Vector3.ZERO)
|
||||
if abs(n.y) < 0.3 and n.length_squared() > 0.0:
|
||||
wall_normal = n.normalized()
|
||||
wall_contact_point = hit.get("position", origin)
|
||||
wall_side = side_data["side"]
|
||||
return wall_normal
|
||||
|
||||
wall_normal = Vector3.ZERO
|
||||
wall_contact_point = Vector3.ZERO
|
||||
wall_side = 0.0
|
||||
return Vector3.ZERO
|
||||
|
||||
|
||||
@@ -89,6 +89,8 @@ var synced_position: Vector3 = Vector3.ZERO
|
||||
var synced_velocity: Vector3 = Vector3.ZERO
|
||||
var synced_is_ads: bool = false
|
||||
var synced_wall_side: float = 0.0 # -1 wall left, +1 wall right (wall-glide bank)
|
||||
var synced_wall_normal: Vector3 = Vector3.ZERO
|
||||
var synced_wall_contact_point: Vector3 = Vector3.ZERO
|
||||
var synced_helmet_closed: bool = false
|
||||
var synced_is_dancing: bool = false # dance emote (B), shown on the model
|
||||
## Which of the five routines in DanceRoutines is playing. Replicated, so other
|
||||
@@ -1071,6 +1073,8 @@ func _physics_process(_delta: float) -> void:
|
||||
# otherwise the first movement frame still samples last frame's Idle.
|
||||
if visual.has_method("set_wall_side"):
|
||||
visual.set_wall_side(sm.wall_side)
|
||||
if visual.has_method("set_wall_surface"):
|
||||
visual.set_wall_surface(sm.wall_normal, sm.wall_contact_point)
|
||||
if visual.has_method("set_wall_glide_motion"):
|
||||
visual.set_wall_glide_motion(velocity)
|
||||
elif visual.has_method("set_wall_run_motion"):
|
||||
@@ -1089,6 +1093,8 @@ func _physics_process(_delta: float) -> void:
|
||||
synced_movement_speed = Vector2(velocity.x, velocity.z).length()
|
||||
synced_is_crouching = sm.input_crouch
|
||||
synced_wall_side = sm.wall_side
|
||||
synced_wall_normal = sm.wall_normal
|
||||
synced_wall_contact_point = sm.wall_contact_point
|
||||
synced_position = position
|
||||
synced_velocity = velocity
|
||||
|
||||
@@ -1167,6 +1173,9 @@ func _process(delta: float) -> void:
|
||||
visual.set_locomotion(d.x, d.y, 1.0 if synced_is_ads else 0.0)
|
||||
if visual.has_method("set_wall_side"):
|
||||
visual.set_wall_side(synced_wall_side)
|
||||
if visual.has_method("set_wall_surface"):
|
||||
visual.set_wall_surface(
|
||||
synced_wall_normal, synced_wall_contact_point)
|
||||
if visual.has_method("set_wall_glide_motion"):
|
||||
visual.set_wall_glide_motion(synced_velocity)
|
||||
elif visual.has_method("set_wall_run_motion"):
|
||||
|
||||
Reference in New Issue
Block a user