rope climbing - 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: rope climbing (/thread-3966.html) |
rope climbing - Alexander34 - 08-08-2023 [attachment=1847] Hello again. I need to make it so that the rope, when playing on the player animation of climbing on it, realistically behaved with respect to the points of contact. Clearly on the attached screenshot. How can I implement this with your Asset in the least costly and simplest way? I can only think of creating a particle group on the fly, but that would be very costly RE: rope climbing - josemendez - 09-08-2023 (08-08-2023, 03:16 PM)Alexander34 Wrote: Hello again. I need to make it so that the rope, when playing on the player animation of climbing on it, realistically behaved with respect to the points of contact. Clearly on the attached screenshot. How can I implement this with your Asset in the least costly and simplest way? Why would it be costly to create particle groups on the fly? they're a very small/simple object with a list of particles, and in the case of ropes they always contain just one index. Code: // Create the attachment: You could also reuse the same particle group and just change the particle index: disable attachment, change particle index, re-enable attachment, in that order. This way you don't even have to allocate any memory at runtime, as you're reusing the same attachment/group. There's another option too: note that dynamic attachments use pin constraints internally to couple particles and rigidbodies, so another option if you don't want to deal with groups/attachments is to create and manage your own pin constraints manually. Note this is a lower-level approach and considerably more complex. The manual contains information about how to create your own constraints at runtime: http://obi.virtualmethodstudio.com/manual/6.3/scriptingconstraints.html There's also a "GrapplingHook" sample scene included that shows you how to create pin constraints at runtime, see Obi/Samples/RopeAndRod/SampleResources/Scripts/ExtendableGrapplingHook.cs kind regards, RE: rope climbing - Alexander34 - 11-08-2023 (09-08-2023, 07:18 AM)josemendez Wrote: Why would it be costly to create particle groups on the fly? they're a very small/simple object with a list of particles, and in the case of ropes they always contain just one index.Thanks, it's roughly clear how I can make the particles between two groups of particles stationary, as in the screenshot in the hat. So that we hold on to the rope with our hands and this segment all the way down to our feet is stretched out of physics? I'm also wondering how to exclude rope collisions with a player's capsule collider but not ignore collisions, e.g. with ground RE: rope climbing - josemendez - 14-08-2023 (11-08-2023, 05:59 PM)Alexander34 Wrote: Thanks, it's roughly clear how I can make the particles between two groups of particles stationary, as in the screenshot in the hat. So that we hold on to the rope with our hands and this segment all the way down to our feet is stretched out of physics? Just set the particle's inverse mass to zero, this will disable physics for them. Then override their position with your own calculations. (11-08-2023, 05:59 PM)Alexander34 Wrote: I'm also wondering how to exclude rope collisions with a player's capsule collider but not ignore collisions, e.g. with ground You can use collision filters for this. You can also calculate and set them at runtime, see the very bottom of this page: http://obi.virtualmethodstudio.com/manual/6.3/scriptingcollisions.html kind regards, RE: rope climbing - Alexander34 - 15-08-2023 (14-08-2023, 06:23 AM)josemendez Wrote: Just set the particle's inverse mass to zero, this will disable physics for them. Then override their position with your own calculations.The thing is that when I turn off the mass of a certain section of rope and reduce its length using _cursor.ChangeLength(_obiRope.restLength + lengthChange * Time.deltaTime); Then instead of shrinking on both sides, it shrinks only on the side where all particles have mass greater than 0. RE: rope climbing - josemendez - 15-08-2023 (15-08-2023, 10:51 AM)Alexander34 Wrote: The thing is that when I turn off the mass of a certain section of rope and reduce its length using _cursor.ChangeLength(_obiRope.restLength + lengthChange * Time.deltaTime); Where the rope shrinks from is determined by the cursor placement ("cursor mu") and direction. You can't have a rope shrink from both sides using a single cursor, btw. See: http://obi.virtualmethodstudio.com/manual/6.3/ropecursor.html |