jaipack17 / Nature2D

A 2D physics engine for Roblox. Create versatile physics simulations and mechanics with GUIs!
https://jaipack17.github.io/Nature2D/
MIT License
146 stars 8 forks source link

GuiObject can't decide which way it should be rotated #1

Closed string-dot-byte closed 3 years ago

string-dot-byte commented 3 years ago

I'm using Nature2D along with a drag module to be able to drag the GuiObject across the screen. When dragging, I noticed that the ImageLabel kept rotating upwards and downwards and couldn't decide even if my mouse was kept still while holding.

I attached the place file where this issue occurs below in a mega. It also appears that smaller sizes of GuiObjects are not effected by this bug. https://mega.nz/file/ORcTXI6T#N3Jh9cpRK976d2nQsBfzw4O4jnoJaaBx7WX6-rGujU4

jaipack17 commented 3 years ago

Ah, I see. Something to do with math.atan2() along the way. Rotating the UI element internally was merely just the angle between the positions of the topLeft and topRight corners. Thus, when the body is at rest, it tends to fluctuate between the 0° mark and 180° mark.

I'll release a fix to this in the next release today. Thanks for bringing this to my attention. I'll close the issue after notifying you about the fix. Cheers!.

jaipack17 commented 3 years ago

@string-dot-byte This should be fixed now! If you encounter the bug again, you can open another issue for the same!