Godot Version
4.3.beta3
Question
I am not sure why I am getting this error with my player movement:
player.gd:203 @ _physics_process(): Call to body_get_collision_layer causing PhysicsServer3D synchronizations on every frame. This significantly affects performance.
<C++ Source> servers/physics_server_3d_wrap_mt.h:198 @ body_get_collision_layer()
<Stack Trace> player.gd:203 @ _physics_process()
I am not calling body_get_collision_layer in the script, so I am quite confused. Is this just a thing with Godot 4.3.beta3? I don’t have the issue in 4.3.beta1
player.gd:203 is move_and_slide() in the following script:
func _physics_process(delta: float) -> void:
if allow_input:
if player_state.crouching:
current_speed = SPEED - CROUCH_SPEED
elif not player_state.crouching:
current_speed = SPEED
if player_state.sprinting:
current_speed = SPEED + SPRINT_SPEED
var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_back")
direction = lerp(direction,(transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized(),delta*inertia)
if direction:
velocity.x = direction.x * current_speed
velocity.z = direction.z * current_speed
else:
velocity.x = move_toward(velocity.x, 0, current_speed)
velocity.z = move_toward(velocity.z, 0, current_speed)
if not is_on_floor():
velocity += get_gravity() * delta
move_and_slide()