Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Questions about adding/removing rope at runtime`
#1
Hi there, 

I'm creating a game that has tug boats and large ships.  I'm now trying to recreate the tow line from Snowrunner where I can basically select tow hitch points from my tugboat and points from large ships.  This would, in turn create a rope between the two.

After messing around and reading the docs/api and then coming to the forums, I found a few posts that help with what I'm looking for, though I'm still struggling to make this work properly.




A few things
Do I create a solver and updater just a single time? 
Do I create the rope actor every time I want to create a new rope - and inversely, do I destroy this rope actor every time I want to remove it?
Or do I create/destroy the blueprint every time I want to make a new one?
Do I need to create/destroy the particle attachments every time? Or do I just keep the ones I have (assuming I don't destroy the actor?)

Thank you in advance!

P.S. Small "quality of life" upgrade;  When I was looking at the docs in the user manual, I clicked on Obi Rope first.  This just expanded the Obi Rope section which immediately made me think that none of the top-level, expandable links were actual content.  I missed out on seeing the Scripting Actors page which has the most useful information IMO https://obi.virtualmethodstudio.com/manu...ctors.html.
Reply
#2
Hi!

(13-02-2024, 03:00 PM)Cleaner Wrote: Do I create a solver and updater just a single time? 

Entirely depends on what you want to do. Solvers determine the vector space used for simulation and which actors are simulated together, updaters determine at which point during the frame specific solvers are updated.

Assuming you want all ropes to be simulated together in the same space and for it to be simulated during FixedUpdate, a single ObiFixedUpdater with a single ObiSolver is ok. You can create them once, then create/destroy ropes inside the solver as many times as you need.

(13-02-2024, 03:00 PM)Cleaner Wrote: Do I create the rope actor every time I want to create a new rope - and inversely, do I destroy this rope actor every time I want to remove it?

Not sure I understand the question... again it entirely depends on what you're after. Usually to create/destroy objects you create/destroy them, but you can also deactivate the object, or deactivate the rope component, or even use object pooling. Which one is better/easier is entirely situational and depends on what you're aiming for and how you want it to work.

(13-02-2024, 03:00 PM)Cleaner Wrote: Or do I create/destroy the blueprint every time I want to make a new one?

Blueprints are assets that determine the overall shape and initial properties of a rope. They can be shared among multiple ropes and you can reuse them as many times as you want, so if you have a single rope that you create/destroy time and time again you can just reuse the same blueprint. If you have different ropes (different lengths, shapes, thicknesses, etc) then they should use separate blueprints.

Drawing a parallel, a blueprint is like a material. You can have multiple objects sharing the same material, and you don't need to create/destroy materials together with the objects using them - unless you want each object to have a completely different material (color, texture, smoothess, etc).

(13-02-2024, 03:00 PM)Cleaner Wrote: Do I need to create/destroy the particle attachments every time? Or do I just keep the ones I have (assuming I don't destroy the actor?)

Same as with everything else, it depends! you can reuse the same attachments and just change their particle group and/or target, or you could destroy the attachment and create a new one. This is similar to joints in Unity: you can modify the properties of a pre-existing joint, or destroy it and create a new one depending on your situation or what's easier to integrate into your project.


(13-02-2024, 03:00 PM)Cleaner Wrote: P.S. Small "quality of life" upgrade;  When I was looking at the docs in the user manual, I clicked on Obi Rope first.  This just expanded the Obi Rope section which immediately made me think that none of the top-level, expandable links were actual content.  I missed out on seeing the Scripting Actors page which has the most useful information IMO https://obi.virtualmethodstudio.com/manu...ctors.html.

Links have a different font color than regular text, however they may be easy to miss them so I will look into making the difference more obvious. Thanks for the feedback! Sonrisa
Reply