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

JoltGeneric6DOFJoint3D angular limit gizmo not correct #855

Open
tlobig opened this issue May 15, 2024 · 9 comments · Fixed by #862
Open

JoltGeneric6DOFJoint3D angular limit gizmo not correct #855

tlobig opened this issue May 15, 2024 · 9 comments · Fixed by #862
Labels
bug Something that isn't working as intended severity:minor Small impact on functionality or usability topic:runtime Concerning runtime behavior (or its source code)

Comments

@tlobig
Copy link

tlobig commented May 15, 2024

while playing around with this addon, which I really like, I figured there is a small issue with the Jolt-version of the 6DOF joints.

The short version: The angular limit gizmos only show the actual limits correctly if the joint itself is rotated by 90 degrees.
screenshot in editor

screenshot when running the scene, notice middle joint is not limiting angle as previewed with Gizmo

steps to reproduce:
should be obvious, have a static body and a rigid body connected by a Jolt 6DOF joint, set an angular limit that's relatively narrow to see the effect AND the gizmo, add a camera and run the scene to see the angular limit is not solved as previewed by the gizmo.

minimal project to reproduce:
jolt_gizmo_minimal.zip

Godot-Jolt version: 0.12.
Godot version: 4.2.1 stable

@github-actions github-actions bot added the needs triage Something that needs investigation label May 15, 2024
@mihe mihe added bug Something that isn't working as intended topic:runtime Concerning runtime behavior (or its source code) severity:minor Small impact on functionality or usability and removed needs triage Something that needs investigation labels May 19, 2024
@mihe
Copy link
Contributor

mihe commented May 19, 2024

Thank you for reporting this. This has been in the back of my mind for a while now, but I never got around to it.

I've spent a silly amount of time trying to make sense of these joint gizmos, ever since I first implemented them, which I realize in hindsight was largely a result of me getting tripped up by the way that single-body joints work in Godot Physics, which I for some reason felt the need to accommodate for (over two-body joints).

With this behavior having changed in #725 I should rightfully have changed the gizmo accordingly, but forgot to.

Anyway, this should be fixed when #862 is merged. It now seems to line up nicely with Jolt's own debug visualization, as well as Nvidia Omniverse, which happens to use a very similar visualization in its USD Composer editor.

@mihe mihe closed this as completed in #862 May 19, 2024
@tlobig
Copy link
Author

tlobig commented May 23, 2024

extremely cool and swift execution. nicely done.

@tlobig
Copy link
Author

tlobig commented May 23, 2024

just compiled the master - is this the intended display of the gizmos?
grafik
grafik

i.e. intuitively I would expect the gizmo to show the range of limits in the direction of the effect, but now it looks like its showing it on the opposite side.

@tlobig
Copy link
Author

tlobig commented May 23, 2024

might be an issue with negative values - I just checked and it looks good with limits above 0°

edit: nope, still weird.

@mihe
Copy link
Contributor

mihe commented May 23, 2024

Would you mind sharing the scene/project? It's hard to tell from the screenshots how you've set it up. It seemed to make sense in the scene I tried it with.

@tlobig
Copy link
Author

tlobig commented May 23, 2024 via email

@mihe
Copy link
Contributor

mihe commented May 23, 2024

Oh, sorry, I had completely glossed over the original repro. I'd had this in my backlog for so long I didn't even bother to check it, so thank you for double-checking the fix.

But yeah, it definitely looks weird/unintuitive in that scene, and now I'm having trouble recalling the setup I had where it made sense to me.

Anyway, I'll need to take another look at this, clearly. I'm very curious what the gizmos in Nvidia Omniverse's USD Composer looks like with this setup.

@mihe mihe reopened this May 23, 2024
@tlobig
Copy link
Author

tlobig commented May 25, 2024

I'm pretty sure all we need is to add or substract half PI from the gizmo angle when calculating the points for it. However while trying this I don't see any effect on the gizmo drawing at all. I must be missing something crucial about the whole plugin build. I had a path error and therefore some problems with testing my code change. back on it.

@tlobig
Copy link
Author

tlobig commented May 25, 2024

sorry, bit pressed for time so I'll be sloppy.
basically you need to revert your change from #862, it's doing the wrong thing
instead line 83 in the jolt joint gizmo .cpp should be something like const float angle = p_limit_lower + angle_step * (float)p_index - Mathf_PI / 2.0;
I also now noticed that the limits must be in range -180° to 180°, which propably follows naturally. It's just the UI doesn't limit this and maybe should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working as intended severity:minor Small impact on functionality or usability topic:runtime Concerning runtime behavior (or its source code)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants