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

Expose joint damping_ratio and natural_frequency per joint to make joints soft #231

Open
Ughuuu opened this issue Aug 27, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@Ughuuu
Copy link
Contributor

Ughuuu commented Aug 27, 2024

There have been 2 issues about PinJoint2D not having softness like Godot has. Rapier just doesn't support per joint softness, so as a workaround you can change the following project wide properties:

  • physics/rapier/joint/damping_ratio
  • physics/rapier/joint/natural_frequency

These will help to make soft joints (eg damping ratio 0.1 and natural_frequency 50).

However, there isn't a way right now in rapier to set these per joint. Here is linked issue in Rapier dimforge/rapier#676

Also, in order to expose new properties (on the joint directly) and hide the softness, this one needs to be solved first: godotengine/godot-proposals#10438 (comment)

@Ughuuu Ughuuu added the bug Something isn't working label Aug 27, 2024
@Ughuuu Ughuuu changed the title Expose something to make joints soft Expose joint damping_ratio and natural_frequency to make joints soft Aug 27, 2024
@Ughuuu Ughuuu changed the title Expose joint damping_ratio and natural_frequency to make joints soft Expose joint damping_ratio and natural_frequency per joint to make joints soft Aug 27, 2024
@Ughuuu Ughuuu added enhancement New feature or request and removed bug Something isn't working labels Aug 27, 2024
@GeminiSquishGames
Copy link

(eg damping ratio 0.1 and natural_frequency 50).

I noticed the range sliders only go from 0 to 10, but started at some huge amount. I guess enter by hand is the key.

@Ughuuu
Copy link
Contributor Author

Ughuuu commented Aug 27, 2024

I can update the range sliders limit, maybe I set it from 0 to 10 by copy pasting other properties. But in any case, this is how most likely softness will be done in godot-rapier. If you want to test it for now until it's done per joint, you can give it a try see if you like it. Another way to make it more reactive is to try:
damping_ratio: 0.8
natural_frequency: 40

Also mass has some importance I think.

@GeminiSquishGames
Copy link

GeminiSquishGames commented Aug 27, 2024

Yeah, I'm using mass quite a bit and noticed I have to use rather lower values. Physics toy, high progression potential, Roguelike, Solar Jetman space shooter type thing. Which reminds me, I notice the units are 100, is that pixels and does that effect linear velocity?
image
image

So far this works and feels fun, but that's probably subjective. I can at least move them around without it feeling weird and stopping the ship or the asteroid immediately. I suppose the tractor beam doesn't really need upgrades like weapons and thrusters or other ship modules, but I thought it might be fun for multiplayer mode to have variance, but it's not a deal breaker at all.

@Ughuuu
Copy link
Contributor Author

Ughuuu commented Aug 31, 2024

The units are 100, that is how many pixels equal 1 meter. It affects some things, unsure if it affects linear velocity though.

@GeminiSquishGames
Copy link

GeminiSquishGames commented Aug 31, 2024

I will test things and scale as needed. I'll probably have to scale up things a bit, if the mass is accurately in kilograms then things should be okay as long as I can stick to the scale, but the lack of z dimension probably leaves room for arbitrary approximations. Damage on impact is calculated with velocity, though the linear_velocity is always what it is the frame after the collision, so I have to grab it on the physics frame just before (another one of Godot's wacky things) . As is it's pixels per second, or if I do it by position each frame manually, pixels per frame. I was going for 128 p/meter so not far off, just to stick with general texture standard powers of 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants