Allow access to PhysicsDirectSpaceState3D from outside the main thread.

Closed
#973 3 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@Arctis-Fireblight is already working on this.

Since Sep 14, 2026.

Assessment

This issue has not been assessed yet.

Description

discussion enhancement topic:physics
Tested versions

This issue is present when using a physics engine module such as GodotPhysics or the new JoltPhysics module.
This is not an issue when using Jolt physics as a GDExtension.

System information

Windows 11

Issue description

The following code prevents access to the PhysicsDirectSpaceState3D outside of the main thread, https://github.com/Redot-Engine/redot-engine/blob/da61fa2c4549ca21d4ee13031177593280395c74/servers/physics_server_3d_wrap_mt.h#L116-L120

I don't believe this check is necessary as there is another check later that verifies that the space state is available, https://github.com/Redot-Engine/redot-engine/blob/da61fa2c4549ca21d4ee13031177593280395c74/modules/jolt_physics/jolt_physics_server_3d.cpp#L233-L239

Removing the main thread check in a custom build allows my project to work with the integrated Jolt physics module just as it does with the GDExtension version.

Steps to reproduce

Attempt a raycast from a thread or from a node running on a sub thread group.

Minimal reproduction project (MRP)

N/A

Dominant language
C++
Stars
6.1k
Forks
337
Avg merge
4d 5h
Merged PRs (30d)
52

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Redot-Engine/redot-engine

All issues in Redot-Engine/redot-engine

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.