Obi Official Forum

Full Version: Raise the rope from a new position
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to edit the rope by code after it has been generated?

Just to exemplify what I would like to do, in the game we are going to have the rope in an initial state with a pin. As the player clicks on the board, we add new pins. 

The idea is to make the rope go through these pins. So the idea was to pass the next rope position with a transform and increase its size. It is possible?

Another solution I was given was to generate another rope and delete the previous one quickly so the player doesn't notice, but I believe this is a very dirty solution.

[Image: bBXfi8.png]
(21-03-2023, 10:33 PM)Stader Wrote: [ -> ]Is it possible to edit the rope by code after it has been generated?

Just to exemplify what I would like to do, in the game we are going to have the rope in an initial state with a pin. As the player clicks on the board, we add new pins. 

The idea is to make the rope go through these pins. So the idea was to pass the next rope position with a transform and increase its size. It is possible?

Hi!

You can change the length of a rope at runtime using a cursor. This allows you to add new particles at any point in the rope (even in the middle) in either direction. Then you can manipulate any property (thickness, mass, position, velocity) on a per-particle basis using the particles API.

See the RopeGrapplingHook sample scene for an example of how you use this technique to create a rope that dynamically grows from point A to point B and gets attached to point B. Your use case is very similar, except you have multiple points.

(21-03-2023, 10:33 PM)Stader Wrote: [ -> ]Another solution I was given was to generate another rope and delete the previous one quickly so the player doesn't notice, but I believe this is a very dirty solution.

If the changes you're making to the rope are very extensive (for instance, if you need to change the entire layout of the rope), updating the rope's blueprint instead of the rope itself can be useful. There's generally no need to destroy the rope GameObject and create a new one.

kind regards,