e7299b17e9
Stack installed: - netfox v1.35.3 (core + extras + noray + internals) - godot-jolt v0.16.0-stable Architecture: - Server: ENet transport (works headless, no netfox deps) - Client/Editor: netfox rollback (RollbackSynchronizer, TickInterpolator) New/modified: - docs/migration-netfox-plan.md — migration architecture - scripts/network/network_manager.gd — netfox-aware ENet fallback - scripts/network/player.gd — clean base player - client/characters/player_netfox.gd — rollback player w/ WeaponManager - client/characters/input/player_net_input.gd — BaseNetInput subclass - client/characters/character/fps_character_controller.gd — netfox input feed - client/weapons/ — weapon data, registry, TacticalWeaponHitscan, WeaponManager - client/scripts/round_replicator.gd — client-side round state bridge - server/scripts/round_manager.gd — improved state machine - server/scripts/plugin_api/plugin_manager.gd — refined plugin system - config: enemy_tag, ally_tag for meatball targeting Removed: old C++ SimulationServer GDExtension (replaced by netfox rollback)
47 lines
1.5 KiB
GDScript
47 lines
1.5 KiB
GDScript
@icon("res://addons/netfox.extras/physics/network-rigid-body-3d.gd")
|
|
extends RigidBody3D
|
|
class_name NetworkRigidBody3D
|
|
|
|
## A rollback / state synchronizer class for RigidBody3D.
|
|
## Set state property path to physics_state to synchronize the state of this body.
|
|
|
|
@onready var direct_state = PhysicsServer3D.body_get_direct_state(get_rid())
|
|
|
|
var physics_state: Array:
|
|
get: return get_state()
|
|
set(v): set_state(v)
|
|
|
|
enum {
|
|
ORIGIN,
|
|
QUAT,
|
|
LIN_VEL,
|
|
ANG_VEL,
|
|
SLEEPING
|
|
}
|
|
|
|
func _notification(notification: int):
|
|
if notification == NOTIFICATION_READY:
|
|
add_to_group("network_rigid_body")
|
|
|
|
func get_state() -> Array:
|
|
var body_state: Array = [Vector3.ZERO, Quaternion.IDENTITY, Vector3.ZERO, Vector3.ZERO, false]
|
|
body_state[ORIGIN] = direct_state.transform.origin
|
|
body_state[QUAT] = direct_state.transform.basis.get_rotation_quaternion()
|
|
body_state[LIN_VEL] = direct_state.linear_velocity
|
|
body_state[ANG_VEL] = direct_state.angular_velocity
|
|
body_state[SLEEPING] = direct_state.sleeping
|
|
return body_state
|
|
|
|
func set_state(remote_state: Array) -> void:
|
|
direct_state.transform.origin = remote_state[ORIGIN]
|
|
direct_state.transform.basis = Basis(remote_state[QUAT])
|
|
direct_state.linear_velocity = remote_state[LIN_VEL]
|
|
direct_state.angular_velocity = remote_state[ANG_VEL]
|
|
direct_state.sleeping = remote_state[SLEEPING]
|
|
|
|
|
|
## Override and apply any logic, forces or impulses to the rigid body as you would in physics_process
|
|
## The physics engine will run its simulation during rollback_tick with other nodes
|
|
func _physics_rollback_tick(_delta, _tick):
|
|
pass
|