problem with dynamic attachment - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: problem with dynamic attachment (/thread-3831.html) |
problem with dynamic attachment - Mickle - 03-04-2023 I have a big of a problem, the rope is connected to a sphere as you can see in the video and i have a script on the sphere that allow me to move it around, the end goal is to just make it swing as you can see in the video, but when i drag the sphere too much, it looks like the rope is disconnected and it freaks out, this only happens when the i assign the attachment type to dynamic, in the case of static, it works fine but again, the whole goal is to make the sphere swing left and right so it should be dynamic RE: problem with dynamic attachment - josemendez - 03-04-2023 Hi, Don't force the position of the sphere (this is a basic rule of thumb when dealing with physics in any engine) as that basically bypasses physics simulation and will only work with a static attachment - since it bypasses simulation too. If you want to drag the sphere in a way consistent with physics, use rigidbody.AddForce to move the sphere towards the mouse cursor. Once the force you apply to the sphere and the one applied by the rope cancel each other out you won't be able to pull further, just like in a real rope. kind regards, RE: problem with dynamic attachment - Mickle - 03-04-2023 (03-04-2023, 03:33 PM)josemendez Wrote: Hi,is there is a way for me to find how much is the force multiplier the rope is adding ? so like i can add the same exact amount of force to the sphere so nothing weirds happens in come cases RE: problem with dynamic attachment - josemendez - 04-04-2023 (03-04-2023, 09:54 PM)Mickle Wrote: is there is a way for me to find how much is the force multiplier the rope is adding ? so like i can add the same exact amount of force to the sphere so nothing weirds happens in come cases Hi, You can access lagrange multipliers on a per-constraint basis, by accessing the "lambdas" array in each constraint batch. You can see an example of this in ObiRope.cs, ApplyTearing method. For information on how constraints are stored in Obi and how to access them, see: http://obi.virtualmethodstudio.com/manual/6.3/scriptingconstraints.html However this is far too convoluted just for your use case imho. Clamp your force to a reasonable value, and just adjust the rope and ball masses accordingly so that the acceleration isn't huge (remember that a = F/m). kind regards, |