Description
The unwrapping of objects, that typically happens when you return a godot-cpp Object*
back to the engine, doesn't seem to happen when it's returned as part of a result struct that's passed as a parameter, such as the collider
field on PhysicsServer3DExtensionRayResult
that's passed to PhysicsDirectSpaceState3DExtension::_intersect_ray
.
This leads to having to employ workarounds such as either manually unwrapping the object, by directly grabbing its internal _owner
field, or calling the internal GDExtension function object_get_instance_from_id
with the object's instance ID. In either case you're forced to also (incorrectly) cast the resulting pointer to a godot-cpp Object*
, since the generated interface still expects that type.
Normally I'd include steps to reproduce the problem and a minimal repro project, but seeing as how this involves result structs for PhysicsDirectSpaceState3D
you need quite a lot of boilerplate to even get to the point where you can call this. So I'm hoping the description will be sufficient for someone familiar with the space. If not, I'd be happy to elaborate further.