![]() |
Help Rope extension, vibration and collision - 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: Help Rope extension, vibration and collision (/thread-4479.html) |
Rope extension, vibration and collision - 0hsyn1 - 19-04-2025 Hello, I am developing a project using the system in your Hook project as a reference. I can lengthen and shorten the rope, but the rope has problems interacting with colliders, as far as I understand the particle count is low. How can I increase this? If my method is wrong, please tell me. When I wrap it around an obstacle, the rope vibrates. Example of the project I am trying to make: https://play.google.com/store/apps/details?id=com.dalakgames.ziplinevalley&pli=1 Point A is fixed, point B is moveable. Thank you ![]() [attachment=2325][attachment=2326][attachment=2327] Code: using System.Collections; Code: public class CapsuleMove : MonoBehaviour RE: Rope extension, vibration and collision - josemendez - 19-04-2025 (19-04-2025, 08:00 AM)0hsyn1 Wrote: Hello, Hi, Increase the rope blueprint's resolution, which in your code is currently set to 0.5f. See the manual for details: https://obi.virtualmethodstudio.com/manual/7.0/ropesetup.html You can also enable surface collisions. See: https://obi.virtualmethodstudio.com/manual/7.0/surfacecollisions.html kind regards, RE: Rope extension, vibration and collision - 0hsyn1 - 19-04-2025 (19-04-2025, 09:09 AM)josemendez Wrote: Hi,Thanks for your quick reply, I was able to increase the number of particles. But when I check the collision section and start wrapping the rope around the obstacle, vibrations occur. Can particles be affected by each other? RE: Rope extension, vibration and collision - josemendez - 22-04-2025 (19-04-2025, 10:15 AM)0hsyn1 Wrote: But when I check the collision section and start wrapping the rope around the obstacle, vibrations occur. I'm not sure about the nature of these "vibrations" you mention. Would it be possible for you to share a video of this? (19-04-2025, 10:15 AM)0hsyn1 Wrote: Can particles be affected by each other? Yes, they're already affected by each other in lots of ways: distance constraints keep them at a specific distance from each other, bend constraints try to keep them in a line as straight as possible, surface collisions make them react when a neighbor particle collides, etc. kind regards, RE: Rope extension, vibration and collision - 0hsyn1 - 23-04-2025 (22-04-2025, 06:37 PM)josemendez Wrote: I'm not sure about the nature of these "vibrations" you mention. Would it be possible for you to share a video of this? I'm sharing a video, even though I increased the particle frequency, it can pass through when I move it a little faster. Hey, I marked the obi rigidbody kinamatics inside the obstacle I wrapped and rope.selfCollisions = false; rope.surfaceCollisions = false; and the shaking stopped. My only problem right now is to reduce the tension of the rope. Sometimes it can be too loose. Another thing I want to ask is, can I access the position list of this rope? I will use it as a path to an object RE: Rope extension, vibration and collision - josemendez - 25-04-2025 (23-04-2025, 02:46 PM)0hsyn1 Wrote: I'm sharing a video, even though I increased the particle frequency, it can pass through when I move it a little faster. May be tunneling. Set the solver's particleCCD to 1. (23-04-2025, 02:46 PM)0hsyn1 Wrote: ht now is to reduce the tension of the rope. Sometimes it can be too loose. Crank up the amount of substeps in your ObiSolver. (23-04-2025, 02:46 PM)0hsyn1 Wrote: Another thing I want to ask is, can I access the position list of this rope? I will use it as a path to an object Yes, you can access all particle properties in any actor. For your purpose however, it's best to grab the position from the path smoother instead of rope particles, since it will give a smooth, continuous position instead of isolated points: Code: var smoother = GetComponent<ObiPathSmoother>(); normalizedCoord varies from 0 (start of the rope) to 1 (end of the rope). You can see an example implementation of a component that places an object along the rope in Obi/Scripts/RopeAndRod/Utils/ObiRopeAttach.cs kind regards RE: Rope extension, vibration and collision - 0hsyn1 - 27-04-2025 Code: public void OnRopeContactEnter(ObiSolver solver, Oni.Contact contact) How do I find the value of "normalizedCoord"? Can I find a value that corresponds to the "M" value in the Obi Rope Attach code? I need the collision value of the item with the rope (e.g. 0.658f) to be able to launch the object from that point. RE: Rope extension, vibration and collision - josemendez - 27-04-2025 (27-04-2025, 07:43 PM)0hsyn1 Wrote: [code]“M” and “normalizedCoord” in my previous message represent the same value. (27-04-2025, 07:43 PM)0hsyn1 Wrote: I need the collision value of the item with the rope (e.g. 0.658f) to be able to launch the object from that point. Just divide the index of the particle by the total amount of active particles in the rope. This will give you a value in the 0-1 range. Kind regards, RE: Rope extension, vibration and collision - 0hsyn1 - 28-04-2025 (27-04-2025, 10:28 PM)josemendez Wrote: “M” and “normalizedCoord” in my previous message represent the same value. I am using this code but I am not getting the result I want, where am I going wrong? My code; Code: int particleIndex = contact.bodyA; [attachment=2335] Even if I try it in reverse as "1f-mu", I can't get the result I want. As an additional question, I am extending this rope and I need to reset it to its initial state at the end of the game. How can I proceed? RE: Rope extension, vibration and collision - josemendez - 28-04-2025 (28-04-2025, 06:38 AM)0hsyn1 Wrote: I am using this code but I am not getting the result I want, where am I going wrong? contact.bodyA is not a particle index. To get the index of the particle in the actor, use the solver.simplices array and then look up solver.particleInActor to get the index of that particle in the rope. See "Retrieving the particle involved in a contact" in the manual: https://obi.virtualmethodstudio.com/manual/7.0/scriptingcollisions.html (28-04-2025, 06:38 AM)0hsyn1 Wrote: As an additional question, I am extending this rope If you're altering the topology of the rope in any way (extending/retracting/cutting the rope) the above approach using particles won't work. The reason is that there's no guarantee new particles (added when extending the rope) will be added at the end/start of the rope, so their indices may be unordered. You must use elements instead as explained in the manual: https://obi.virtualmethodstudio.com/manual/7.0/scriptingropes.html The approach is similar: get a particle index from the contact, then iterate over all elements until you find the one that references that particle. Once you have the index of the desired element, divide it by the number of elements in the rope to get the normalized coordinate. (28-04-2025, 06:38 AM)0hsyn1 Wrote: and I need to reset it to its initial state at the end of the game. How can I proceed? Simply reloading the original rope blueprint (by assigning it to rope.ropeBlueprint) should do it. kind regards, |