Fix: rejoining stacked players on top of each other (one fell through)
checkpoint / checkpoint (push) Successful in 1m40s
checkpoint / checkpoint (push) Successful in 1m40s
All players spawned at the exact same PlayerSpawn point and were on the same collision layer, so two overlapping CharacterBody3Ds triggered a physics depenetration shove that could launch one through the 1-unit-thick floor. - server.gd: golden-angle spawn spread -- each join lands ~1m+ from the others, growing outward, never exactly repeating. - server_player.tscn + player.tscn: players on collision layer 2, mask 1 (world only) -- players no longer collide with each other at all (fine for a social game; also removes the shove). - player_spawner.gd + player.gd: hard safety net -- if y < -10 (any tunnel-through), snap back to the spawn instead of falling forever. Verified: 3 server players spawn 1.15m+ apart, none fall, all rest on the floor. 2p multiplayer + network_client smokes green. Client-side -- rebuild the exe. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015jtxAiu5dAW4WxCNdGkrkJ
This commit is contained in:
@@ -26,6 +26,7 @@ const MOUSE_SENSITIVITY: float = 0.003
|
||||
|
||||
var _input_direction := Vector2.ZERO
|
||||
var _camera_pitch: float = -0.12
|
||||
var _spawn_position: Vector3 = Vector3(0, 1.5, 0)
|
||||
|
||||
## Vertical offset applied to the assembled avatar so its feet (origin y=0)
|
||||
## line up with the bottom of the player's collision capsule.
|
||||
@@ -69,6 +70,7 @@ func _ready() -> void:
|
||||
else:
|
||||
push_warning("player.gd: no PlayerSpawn marker found; spawning at origin")
|
||||
global_position = Vector3(0, 1.0, 0)
|
||||
_spawn_position = global_position
|
||||
|
||||
# The spring arm must not collide with the player's own capsule (they're
|
||||
# on the same layer), or the camera gets yanked right up against the
|
||||
@@ -192,6 +194,11 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
move_and_slide()
|
||||
|
||||
# Safety net -- never fall forever if something goes wrong.
|
||||
if global_position.y < -10.0:
|
||||
global_position = _spawn_position
|
||||
velocity = Vector3.ZERO
|
||||
|
||||
net_input = {
|
||||
"move_x": direction.x, "move_z": direction.z,
|
||||
"jump": jumped, "look_yaw": rotation.y,
|
||||
|
||||
Reference in New Issue
Block a user