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

PinJoint2d not using softness, no elasticity. #230

Closed
GeminiSquishGames opened this issue Aug 27, 2024 · 9 comments
Closed

PinJoint2d not using softness, no elasticity. #230

GeminiSquishGames opened this issue Aug 27, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@GeminiSquishGames
Copy link

Describe the bug

The PinJoint node is lacking softness that it's Godot counterpart has.

To Reproduce

Make two rigidbody2d nodes and connect them to a pinjoint2d, set the softness all the way up and observe how they are sill tightly bound and have no elastic give between them. no change from 0.0 softness.

Expected behavior

I expect them to act more like elastic keeping them together rather than a solid rod when softness is not 0.0, and have the same ammount of elastic as Godot's version. solid at 0.0 is fine and expected.

Environment:
Windows Godot 4.3

Example project(zip)

Should be simple enough to do quickly without, but I will if you cannot reproduce.

@GeminiSquishGames GeminiSquishGames added the bug Something isn't working label Aug 27, 2024
@Ughuuu
Copy link
Contributor

Ughuuu commented Aug 27, 2024

Related to this: #194
Rapier doesn't have softness on pin joints right now. I added in readme at limitations chapter. Read the linked Issue to see more. Basically when the thing needed to expose softness (in some form) in rapier enters, then godot-rapier can use that for softness (kinda)

@Ughuuu Ughuuu closed this as completed Aug 27, 2024
@Ughuuu
Copy link
Contributor

Ughuuu commented Aug 27, 2024

Again, I could leave this open, just to track that softness is missing, but I also added to the readme. And anyway there isn't anything to "fix" in godot-rapier, the implementation part needs to happen in rapier lib.
Actually just for reference will create an enchancement task for something similar to this.

@Ughuuu
Copy link
Contributor

Ughuuu commented Aug 27, 2024

Tracked by: #231

@GeminiSquishGames
Copy link
Author

GeminiSquishGames commented Aug 27, 2024

Got it. Will make due, can't really rely on the project settings for several different behaviors at once, but the spring joint behavior seems to be useful for somewhat similar results, just not as predictable and smooth... or maybe soft... or whatever. Also, sorry for the redundancy, I kinda just checked if there was an open issue, so having one open might be good in case someone does the same.

@Ughuuu
Copy link
Contributor

Ughuuu commented Aug 27, 2024

Np. I know, I also kind of want/like the softness of pin joint more, and also the fact that pin joint has limits is better. I used the project settings and got good results, but y it does change the result of all joints, so not good option to do individual softness.

@GeminiSquishGames
Copy link
Author

GeminiSquishGames commented Aug 27, 2024

I looked at your request issue on the main rapier repo and thought of a few things. The softness on Godot physics goes from 0 to 16 for me... is that not right? Godot's PinJoint2D also has angular clamping, but I think that works, maybe, as well as a motor for automated locomotion which seems to turn in the GodotRapier addon but not so much the same as in Godot physics but I have to test again when I have time to describe the differences better, and there is a bias between the two objects using the joint, just incase that's doable and to keep it as close as possible of a replacement. It's hard for me to tell what might be working right even in Godot's physics case as things seem off to me compared to Unity's joints. Surely Unity does everything right... right? :P

@Ughuuu
Copy link
Contributor

Ughuuu commented Aug 27, 2024

Godot Physics exposes all settings and as I said there is no way to hide them (right now).
Rapier doesn't do softness. It does not. The softness in Godot is between 0 and 16, yes.
Rapier has other settings that do, lets call it, "joint takes more to stabilise" setting. This is not the same as "softness", as you noted. So in this case, Rapier has 1 setting, and Godot has another setting.
That's what the proposal I opened in Godot Proposals is about, it's about hiding things that Rapier doesn't do (eg. bias for eg. also) from the inspector so people aren't confused. And it's also about adding new properties that Godot does not have at all (one example is collision shapes with rounded corners, thats something Godot does not have at all).

What Unity has doesn't have much to do here, basically the whole purpose of Rapier (godot-rapier, the godot addon) is to expose the settings of Rapier Lib (the rapier rust library). That's it. If there are matches with Godot, then expose them as they are. If not, then that's it. We need to accept that limitation and see what we can do as a workaround.

Sure, we are allowed to open issues in Rapier mainstream and make proposals, and that's also an option. However, right now Rapier does have something similar to softness, so my thought was to use that.
Another problem is Godot doesn't allow modifying the inspector, so thats the second problem.

@GeminiSquishGames
Copy link
Author

Ah, so the angular clamping and motor are a fluke and will eventually go away you mean? I'll make a note of that. What I mean about Unity is just what I'm used to vs what Godot does out of the box personally, so it's hard for me to tell since they are, all three things, different creatures. I really can't tell if Rapier does anything right, just that I can use it to do what I want with minimal effort compared to Godot default. The thing about Unity was just what I'm used to, but I want it in a raster renderer not pretend 2D in a 3D space, so Godot is my choice, but it's default is wonkier than wonky.

The project settings work well for now actually, and may just have to work for a while, so thank you for your help and patience with me. I sometimes have a hard time being succinct and trying to get all of my thoughts out properly and questions asked well to get answers. I still don't really understand all of the Rapier settings so I will try using it's own documentation.

@Ughuuu
Copy link
Contributor

Ughuuu commented Aug 27, 2024

No, angular limits and motors are there to stay (for pin joint) And for all joints to come (after the change, I think at least). Best to see is what rapier has to offer I think for joints for a sneak peak of what it has: https://rapier.rs/docs/user_guides/rust/joints

I want to expose all that rapier has to offer for joints for all joints godot has. So the softness will come for all joints, the angular limits probably also for all joints? I'll see what rapier has and map it to the nodes.

Right now it's hard to know what works and what doesn't, but this is because Godot doesn't offer the option to do so. So only thing I can do now is no-op in such a case.

Hopefuly this will be impl in godot 4.4 (or later, though I really hope 4.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants