Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding shapes and bodies from the PhysicsServer doesn't work in C# #46600

Closed
Tracked by #45333
snouk-z opened this issue Mar 2, 2021 · 5 comments
Closed
Tracked by #45333

Adding shapes and bodies from the PhysicsServer doesn't work in C# #46600

snouk-z opened this issue Mar 2, 2021 · 5 comments

Comments

@snouk-z
Copy link

snouk-z commented Mar 2, 2021

Godot version:
3.2.3 Mono

OS/device including version:
Kubuntu 20.04

Issue description:
With C#, Trying to implement a collision in the scene using the PhysicsServer doesn't work. The game runs and there's no error in the terminal output but the collision isn't there. No interaction possible.

Minimal reproduction project:
https://github.com/snouk-z/test_servers
The repository also contains a GDScript implementation (which is working) to show the expected result.

EDIT

I actually find the source of the problem. The C# API doesn't match the GDScript one for BodyAddShape.

The GDScript PhysicsServer API describes the function like this :
void body_add_shape ( RID body, RID shape, Transform transform=Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ), bool disabled=false )

The C# API like this :
public static void BodyAddShape(RID body, RID shape, Transform? transform = null, bool disabled = false);

In C# the transform parameter is null by default instead of a transform with a default value. We must provide it or the resulting shape will not appear in the scene.

The C# API should be changed to match the GDScript one.

@snouk-z
Copy link
Author

snouk-z commented Mar 2, 2021

Looks like the issue might come from the BodyAddShape(RID body, RID shape) PhysicsServer's method. Everything works if I ask a GDScript node to call it instead.

@gururise
Copy link
Contributor

Can confirm this is still a problem in 3.3.2 and the latest 3.3.3 git.

@raulsntos
Copy link
Member

This was fixed in master by #45424 and backported to 3.x by #49702.

@akien-mga akien-mga added this to the 4.0 milestone Jul 26, 2021
@akien-mga
Copy link
Member

Thanks, closing.

@aaronfranke
Copy link
Member

Also cherry-picked for Godot 3.3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants