godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Expose HingeJoint3D angle as a property #4385

Open croxis opened 2 years ago

croxis commented 2 years ago

Describe the project you are working on

A 3D space game where I am trying to use hinges to serve as docking ports on a spinning space station.

Describe the problem or limitation you are having in your project

I would like for ships to undock (by clearing node_b in HingeJoin3D) when the hinge reaches 90 degrees (example). However there is currently no obvious way to get the angle of the joint, or directly set it.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Exposing a hinge.angle parameter in the editor and gdscript. Getter could use GodotHingeJoint3D::get_hinge_angle() and the setter would be a set_hinge_angle(x) function.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I assume this would be no different than existing editor parameters (famous last words...)

If this enhancement will not be used often, can it be worked around with a few lines of script?

Calculating the existing angle could be done in GDscript, but setting the angle is not.

Is there a reason why this should be core and not an add-on in the asset library?

This is improving the functionality of existing nodes.

robert405 commented 2 years ago

Hi, I just wanted to know if you decided to add this property in the future? If yes, it would be appreciated to know when you expect this to become an available property? Thank you for your support!

Calinou commented 2 years ago

Hi, I just wanted to know if you decided to add this property in the future? If yes, it would be appreciated to know when you expect this to become an available property? Thank you for your support!

This proposal has received little community support, and there is no ETA for feature development. Physics contributors are also few and far between in Godot. Therefore, I wouldn't count on this being implemented for 4.0.

robert405 commented 2 years ago

Wow thanks for the quick response! I'll make the calculation myself then, it would i've been more clean to have a single call but a couple of line of code will do the same. Thanks you again!