godot-nim icon indicating copy to clipboard operation
godot-nim copied to clipboard

Nim constructor not found for class BulletPhysicsDirectSpaceState

Open geekrelief opened this issue 3 years ago • 1 comments

Using Bullet, on a Spatial object I'm trying to do a ray cast with PhysicsDirectSpaceState

  var spaceState = self.getWorld().directSpaceState

The above generates an error from godotnim.nim. asNimGodotObject calls newNimGodotObject with the name returned from godotinternal.nim#getClassNameRaw().

BulletPhysicsDirectSpaceState is not part of the api.json.

This isn't the fault of godot-nim. The godot engine doesn't export it properly. The work around is modify godottypes.nim with a new type and register the class.

BulletPhysicsDirectSpaceState* = ref object of PhysicsDirectSpaceState

...

registerClass(BulletPhysicsDirectSpaceState, "BulletPhysicsDirectSpaceState", true)

I've bugged this https://github.com/godotengine/godot/issues/48752 and created an engine PR to fix.

geekrelief avatar May 16 '21 06:05 geekrelief

Yes, this basically duplicates #91. Thanks for submitting the PR to Godot.

endragor avatar May 16 '21 12:05 endragor