09-10-2020, 02:48 PM
(This post was last modified: 09-10-2020, 02:49 PM by josemendez.)
(09-10-2020, 12:48 PM)Eulenmensch Wrote: Hi, love the asset so far, great UX and really powerful!
I am doing fine with ropes that I author and place in the scene but am running into some issues/questions now that I'm attempting to instantiate them at runtime.
My usecase is that I have a Helium Balloon(rigidbody with up force applied) that spawns and attaches to other rigidbodies on collision. I want this attachment to be an Obi Rope to simulate the string of the balloon.
For that I would need to set the start and end nodes of a rope to the balloons position and the impact point respectively.
Do I need to create a blueprint at runtime for each of the ropes to do so?
How do I know which index each particle group of a rope has?
Thanks for the great asset!
Hi there!
If you're going to create each rope at runtime, they will presumably have different lengths/shapes, so yes you should create a separate blueprint for each one. There's no downsides in doing this. Check out the included RopeGrapplingHook sample scene for some code that creates both blueprints and ropes programmatically (/Obi/Samples/RopeAndRod/SampleResources/Scripts/GrapplingHook.cs)
To retrieve the indices of the particles in a particle group, just do:
Code:
List<int> indices = rope.blueprint.groups[groupIndex].particleIndices;
In the case of ropes, particle groups only contain 1 particle each, so even though particleIndices is a List you can count on it having only one entry.
cheers!