@@ -70,22 +70,21 @@ func send_output_to_client_unreliable(states_udp_json_string: String):
7070 player .camera_arm .rotation = Vector3 (str_to_var ("Vector3" + states_udp ["player" ][id ]["camera_arm_rotation" ]))
7171 if states_udp .has ("moving_cube" ):
7272 for id in states_udp ["moving_cube" ]:
73-
7473 if get_node ("/root/main/maps/" ).get_child_count () > 0 :
75- print (get_node ("/root/main/maps/" ).get_child (0 ).name )
76-
7774 var moving_cube = get_node ("/root/main/maps/" ).get_child (0 ).get_node (id )
7875 if states_udp ["moving_cube" ][id ].has ("rotation" ):
7976 moving_cube .rotation = Vector3 (str_to_var ("Vector3" + states_udp ["moving_cube" ][id ]["rotation" ]))
8077 if states_udp ["moving_cube" ][id ].has ("position" ):
8178 moving_cube .position = Vector3 (str_to_var ("Vector3" + states_udp ["moving_cube" ][id ]["position" ]))
79+ if states_udp .has ("rigid_cube" ):
80+ for id in states_udp ["rigid_cube" ]:
81+ if get_node ("/root/main/maps/" ).get_child_count () > 0 :
82+ var rigid_cube = get_node ("/root/main/maps/" ).get_child (0 ).get_node (id )
83+ if states_udp ["rigid_cube" ][id ].has ("rotation" ):
84+ rigid_cube .rotation = Vector3 (str_to_var ("Vector3" + states_udp ["rigid_cube" ][id ]["rotation" ]))
85+ if states_udp ["rigid_cube" ][id ].has ("position" ):
86+ rigid_cube .position = Vector3 (str_to_var ("Vector3" + states_udp ["rigid_cube" ][id ]["position" ]))
8287
83- # var rotation = Vector3(str_to_var("Vector3" + output["rotation"]))
84- # get_node("/root/main/players/" + str(id) + "/" + str(id)).rotation = rotation
85- # var position = Vector3(str_to_var("Vector3" + output["position"]))
86- # get_node("/root/main/players/" + str(id) + "/" + str(id)).position = position
87- # var camera_arm_rotation = Vector3(str_to_var("Vector3" + output["camera_arm_rotation"]))
88- # get_node("/root/main/players/" + str(id) + "/" + str(id) + "/SpringArm3D").rotation = camera_arm_rotation
8988
9089@rpc ("call_remote" , "reliable" )
9190func send_output_to_client_reliable (states_tcp_json_string : String ):
@@ -95,9 +94,3 @@ func send_output_to_client_reliable(states_tcp_json_string: String):
9594 var player = get_node ("/root/main/players/" + id + "/" + id )
9695 if states_tcp ["player" ][id ].has ("camera_arm_scale" ):
9796 player .camera_arm .scale = Vector3 (str_to_var ("Vector3" + states_tcp ["player" ][id ]["camera_arm_scale" ]))
98-
99- # var output: Dictionary = JSON.parse_string(output_json_string)
100- # var id = int(output["id"])
101- # var camera_arm_scale = Vector3(str_to_var("Vector3" + output["camera_arm_scale"]))
102- ## print("received scale: " + str(camera_arm_scale))
103- # get_node("/root/main/players/" + str(id) + "/" + str(id) + "/SpringArm3D").scale = camera_arm_scale
0 commit comments