Open prokopst opened 6 years ago
It seems BulletPhysicsDirectSpaceState
is not registered in ClassDB (running grep "register_class<BulletPhysicsDirectSpaceState" **/*.cpp
on the godot codebase returns nothing).
Given Python bindings is lazy and generated from Godot's ClassDB informations, this would explain your crash.
This leave open the question why C# binding is not affected (even if it's a static binding generated at compilation time, I would expect it to be generated from the ClassDB informations anyway...) You should open an issue on the main Godot project linking this issue.
I've found that World::get_direct_space_state
actually returns an instance of abstract class PhysicsDirectSpaceState
.
https://github.com/godotengine/godot/blob/master/scene/resources/world.h#L82
PhysicsDirectSpaceState
is registered as a virtual class using register_virtual_class
:
https://github.com/godotengine/godot/blob/master/servers/register_server_types.cpp#L151
FYI, such dirty workaround seems to work:
import godot.bindings as godot_bindings
godot_bindings.BulletPhysicsDirectSpaceState = godot_bindings.PhysicsDirectSpaceState
If I understand correctly C# takes the type from a method return type: https://github.com/godotengine/godot/blob/ef5672d3f94a7321ed779c922088bb72adbb1521/modules/mono/editor/bindings_generator.cpp#L1903
Not from the actual type of a value returned like Python bindings do.
I was trying to port my existing Godot C# experiment into Python and I got into weird trouble. The code follows this tutorial and explodes when trying to get
self.get_world().direct_space_state
onAttributeError: module 'godot.bindings' has no attribute 'BulletPhysicsDirectSpaceState'
.Error:
Everything
^Bullet.+
indir(godot.bindings)
:I can try zip my project if necessary.