appsinacup / godot-rapier-physics

Godot Rapier Physics – A 2D and 3D drop-in replacement for the Godot engine that adds stability and fluids.
https://godot.rapier.rs
MIT License
348 stars 17 forks source link

Area2d Effect not working on pinned objects. #101

Closed Galllaa closed 2 months ago

Galllaa commented 4 months ago

If a node is pinned the effect of the area2d will not work on that node.

Should behave as all rigibodys behave while under the effect (gravity_direction)

Example

AreaEffect.zip

Ughuuu commented 2 months ago

This is now reproducing a crash. When the object hits the area, the addon crashes

Ughuuu commented 2 months ago

Fixed the crash. It looks like the gravity works, kind of, just that it tries to move the whole object instead of trying to rotate it.

Ughuuu commented 2 months ago

Ok so it's a bit of a weird issue, I will first put a screenshot of how the case looks like and what you try to achieve:

image

Basically there is a plus sign that is all perfectly built. This plus sign interacts with an area(the blue thing) and it receives gravity of (2800, 980). Running on both Godot and Rapier the following line results in same gravity:

print(get_gravity()) # (2800, 980)

It seems that it tries to move the shape to the right and down, and its also pinned. Pins work differently in rapier, as they don't have softness.

Trying to move that shape while it's pinned, it's hard to say if it should result in any torque or not. Rapier currently doesnt give it any torque, as it is applying the force to the center, so its trying to move the shape. If you move the pin just a bit, it will have torque.

Ughuuu commented 2 months ago

Will close this for now, it does look like it does what it should, if you think it should do something differently let me know. I know it feels like it should rotate the thing, but the truth is it applies linear_velocity, thats what gravity is.