Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
godot [2025/01/05 13:10] jango |
godot [2025/01/31 10:18] (aktuell) jango [Links] |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| [[https:// | [[https:// | ||
| - | [[https:// | + | [[https:// |
| =====Bodies===== | =====Bodies===== | ||
| Zeile 185: | Zeile 185: | ||
| ====Raycast2D==== | ====Raycast2D==== | ||
| + | |||
| + | < | ||
| + | extends Raycast2D | ||
| + | |||
| + | var raycast_length = 10.0 | ||
| + | |||
| + | func _ready(): | ||
| + | raycast.target_position = Vector2(0, raycast_length) | ||
| + | raycast.enabled = true | ||
| + | |||
| + | func _physics_process(delta): | ||
| + | if is_colliding(): | ||
| + | print(" | ||
| + | else: | ||
| + | print(" | ||
| + | </ | ||
| < | < | ||
| Zeile 198: | Zeile 214: | ||
| add_child(raycast) | add_child(raycast) | ||
| - | func is_on_ground(): | + | func _process(delta): |
| - | | + | |
| - | + | print(" | |
| - | func _physics_process(delta): | + | |
| - | if is_on_ground(): | + | |
| - | print(" | + | |
| else: | else: | ||
| - | print(" | + | print(" |
| </ | </ | ||
| Zeile 232: | Zeile 245: | ||
| </ | </ | ||
| + | < | ||
| + | func shoot(): | ||
| + | var space = get_world_3d().direct_space_state | ||
| + | var query = PhysicsRayQueryParameters3D.create( | ||
| + | global_position, | ||
| + | global_position - global_transform.basis.z * 2 | ||
| + | ) | ||
| + | var collision = space.intersect_ray(query) | ||
| + | if collision: | ||
| + | print(collision.collider.name) | ||
| + | </ | ||
| =====Signals===== | =====Signals===== | ||
| Zeile 594: | Zeile 618: | ||
| child.engine_force = engine_force | child.engine_force = engine_force | ||
| </ | </ | ||
| + | |||
| + | |||
| + | =====Networking===== | ||
| + | |||
| + | ====RPC==== | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | < | ||
| + | func _process(): | ||
| + | rpc(" | ||
| + | rpc_unreliable(" | ||
| + | rpc_function.rpc() | ||
| + | rpc_function.rpc_id(peer_id) # call it on a specified peer | ||
| + | | ||
| + | @rpc(mode, sync, transfer, channel) | ||
| + | func rpc_function(): | ||
| + | var sender = multiplayer.get_remote_sender_id() | ||
| + | if sender == get_multiplayer_authority(): | ||
| + | do_stuff() | ||
| + | </ | ||
| + | |||
| + | ===Mode=== | ||
| + | |||
| + | Von wem kann die Funktion ausgeführt werden. Default ist " | ||
| + | |||
| + | < | ||
| + | Node.set_multiplayer_authority() | ||
| + | </ | ||
| + | |||
| + | auf einer per-Peer-Basis konfigurieren. | ||
| + | |||
| + | * authority: Funktion kann **nur von dem Peer der die Multiplayer Authority hat** ausgeführt werden, nicht von anderen peers | ||
| + | * any_peer: Funktion kann **von jedem peer** ausgeführt werden | ||
| + | |||
| + | ===Sync=== | ||
| + | |||
| + | Wo wird die Funktion ausgeführt. Nur remote oder auch lokal. | ||
| + | |||
| + | * call_remote: | ||
| + | * call_local: Funktion wird beim Aufruf **remote und auch lokal** ausgeführt | ||
| + | |||
| + | ===Transfer=== | ||
| + | |||
| + | * unreliable: UDP | ||
| + | * unreliable_ordered: | ||
| + | * reliable: TCP | ||
| + | |||
| + | ===Channel=== | ||
| + | |||
| + | Muss immer das letzte Argument sein. | ||
| =====Links===== | =====Links===== | ||
| Zeile 607: | Zeile 682: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||