mphe / GDNative-Ropesim

A 2D verlet integration based rope simulation for Godot 4. Written in C++ using GDExtension for fast performance.
MIT License
46 stars 1 forks source link

Issue with Rop and Rope Handler interaction #9

Open MudkipWorld opened 4 weeks ago

MudkipWorld commented 4 weeks ago

Hi, I found this add-on and it is very interesting, but when I tried one of the main features I was hoping to work well the most.. It seems somewhat broken. Example : Rope Issue

Basically the connected part of the rope and handler are very much detach, I have tried fixing this myself by making my own custom handler, but the issue seems to come from the rope itself and I have no idea how to fix it. By any chance will this get fixed?

mphe commented 4 weeks ago

This is actually not a bug but expected behavior. The handle just sets the point of the rope to its current position every frame. The rope simulation algorithm proceeds to handle the rope in the same way as usual without regard to handles. If you set the handle point somewhere inside the rope instead of the end, you will also notice how it doesn't snap 100% towards the handle.

There is currently no support for completely fixating points at certain positions. I agree this might be a little confusing, but RopeHandles were intended to be a simple solution for animating and deforming ropes with good-enough accuracy.

MudkipWorld commented 4 weeks ago

Ah, I see! Makes more sense now. Thanks for the answer

mphe commented 4 weeks ago

I will leave the issue open, because technically it is an issue that can be fixed.

mphe commented 3 days ago

I've been working on an efficient way to completely fixate points. You can try out on the endpoint_fixation branch or download a build from the latest build workflow. There is now a strenght property in RopeHandle to control how strong a point is pulled to the handle's position. A strength of 1.0 will completely fixate the point without gaps. The new version also includes much more example scenes. It is not yet merged into master but I plan to do so in near future.

MudkipWorld commented 2 days ago

Thank you so much for your hard work! Happy to hear you were able to fix it (even if it was in a different branch). If you feel like this issue had been solved, I don't mind if it got closed. Again thanks for your work :D