Jittering but synchronized physics state
This commit is contained in:
@ -550,9 +550,6 @@ physics_mode = 2
|
||||
transform = Transform3D(0.99989736, 0, 0.014328662, -0.014328662, -4.371139e-08, 0.99989736, 6.263257e-10, -1, -4.37069e-08, -1.5009866, -1.4999988, 1.9908428)
|
||||
physics_mode = 2
|
||||
|
||||
[node name="Spawner" parent="." unique_id=6714366 instance=ExtResource("3_ism2t")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="." unique_id=1071155008]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.4, 1, -3)
|
||||
|
||||
@ -569,5 +566,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.4, 1, 4)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3)
|
||||
current = true
|
||||
|
||||
[node name="Spawner" parent="." unique_id=6714366 instance=ExtResource("3_ism2t")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="." unique_id=2096937457]
|
||||
replication_config = SubResource("SceneReplicationConfig_ism2t")
|
||||
|
||||
@ -35,6 +35,7 @@ properties/4/replication_mode = 0
|
||||
|
||||
[node name="CharacterPawn3D" type="RigidBody3D" unique_id=288275840]
|
||||
physics_interpolation_mode = 1
|
||||
top_level = true
|
||||
script = ExtResource("1_4frsu")
|
||||
metadata/_custom_type_script = "uid://cdmmiixa75f3x"
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ func _scan_and_weld_neighbors():
|
||||
_create_weld_to(other_piece)
|
||||
|
||||
func _create_weld_to(neighbor: StructuralPiece):
|
||||
print("Welding %s to %s" % [self.name, neighbor.name])
|
||||
# print("Welding %s to %s" % [self.name, neighbor.name])
|
||||
|
||||
# 1. Create the Joint
|
||||
var joint = Generic6DOFJoint3D.new()
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
extends Area3D
|
||||
class_name Spawner
|
||||
class_name Spawner extends Area3D
|
||||
|
||||
@onready var mp_spawner: MultiplayerSpawner = $MultiplayerSpawner
|
||||
@export var disabled: bool = false
|
||||
@ -10,6 +9,7 @@ func _ready():
|
||||
# We wait one frame to ensure singletons are ready.
|
||||
await get_tree().process_frame
|
||||
GameManager.register_spawner(self)
|
||||
mp_spawner.spawn_path = get_parent().get_path()
|
||||
|
||||
func can_spawn() -> bool:
|
||||
return false if disabled else get_overlapping_bodies().is_empty()
|
||||
|
||||
@ -5,12 +5,12 @@
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_lldyu"]
|
||||
radius = 1.0
|
||||
|
||||
[node name="Spawner" type="Area3D"]
|
||||
[node name="Spawner" type="Area3D" unique_id=1511371555]
|
||||
script = ExtResource("1_lldyu")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1330579270]
|
||||
shape = SubResource("SphereShape3D_lldyu")
|
||||
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="." unique_id=1624471299]
|
||||
_spawnable_scenes = PackedStringArray("uid://7yc6a07xoccy")
|
||||
spawn_path = NodePath("..")
|
||||
|
||||
@ -42,7 +42,7 @@ func _ready():
|
||||
if physics_mode == PhysicsMode.ANCHORED:
|
||||
_update_gravity_proxy()
|
||||
linear_velocity = gravity_proxy_parent.linear_velocity if is_instance_valid(gravity_proxy_parent) else Vector3.ZERO
|
||||
print(name, " initialized as ANCHORED with gravity proxy: ", gravity_proxy_parent)
|
||||
# print(name, " initialized as ANCHORED with gravity proxy: ", gravity_proxy_parent)
|
||||
|
||||
func _notification(what):
|
||||
# Automatically update gravity proxy when the scene hierarchy changes
|
||||
@ -68,10 +68,10 @@ func _update_gravity_proxy():
|
||||
# 2. Assign the proxy
|
||||
if new_proxy != gravity_proxy_parent:
|
||||
gravity_proxy_parent = new_proxy
|
||||
if new_proxy:
|
||||
print(name, " auto-parented gravity proxy to: ", new_proxy.name)
|
||||
else:
|
||||
print(name, " detached from gravity proxy (Independent Mode).")
|
||||
# if new_proxy:
|
||||
# print(name, " auto-parented gravity proxy to: ", new_proxy.name)
|
||||
# else:
|
||||
# print(name, " detached from gravity proxy (Independent Mode).")
|
||||
|
||||
# --- PUBLIC FORCE APPLICATION METHODS ---
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ func _try_spawn_waiting_player():
|
||||
var player_id = waiting_players.pop_back()
|
||||
|
||||
print("GameManager: Spawner is now available. Spawning waiting player %d." % player_id)
|
||||
var spawn_point = find_available_spawner()
|
||||
var spawn_point: Spawner = find_available_spawner()
|
||||
|
||||
if spawn_point:
|
||||
_spawn_player_pawn(player_id)
|
||||
@ -67,7 +67,8 @@ func _try_spawn_waiting_player():
|
||||
|
||||
# pawn.set_multiplayer_authority(player_id)
|
||||
|
||||
spawn_point.add_child(pawn)
|
||||
get_node(spawn_point.mp_spawner.spawn_path).add_child(pawn)
|
||||
pawn.global_transform = spawn_point.global_transform
|
||||
|
||||
# Traverse up to find the physics body (Ship/Module) we just spawned inside
|
||||
var parent_body = _get_orbital_body_ancestor(spawn_point)
|
||||
|
||||
Reference in New Issue
Block a user