29-04-2024, 07:40 AM
(This post was last modified: 29-04-2024, 07:46 AM by josemendez.)
(29-04-2024, 12:05 AM)wrcampbell1 Wrote: Hey,
I tried looking into both the API and previous posts. It seems that this was possible at one point, but now there's no real information on it.
I want to create a cartoonish "bulge" effect in the an Obi Rope that animates through the rope, similar to old Loony Toon cartoons, as seen below:
Hi,
Obi includes an example of this exact use case, see the "Firehose" sample scene.
(29-04-2024, 12:05 AM)wrcampbell1 Wrote: I've noticed that I can grab the ObiRope Component, access it's ObiPath, then it's thicknesses channel, and then the data itself as a list of floats, and I can modify them directly. In order to apply the effect I was using the ObiPath's OnPathChanged Unity Event and invoking that.
However, the results I'm getting don't appear to be right. It looks like the particles are updating randomly and infrequently. As in, the whole rope changes from thick to thin randomly and no part of it bulges differently.
This approach doesn't make any sense: you're modifying the blueprint, which is an asset that stores the initial data for the rope on disk. Once a rope is instantiated from a blueprint, they're no longer linked together: the rope won't reflect changes made to the blueprint unless you re-Genenerate() the blueprint, which is a very expensive operation as it involves essentially destroying all ropes using it and then creating them anew. So in a way, what you're doing is akin to modifying a .fbx mesh asset and reimporting it just to change mesh vertex positions.
Being a particle-based engine, all runtime data in Obi is stored as particles. You can read/write all per particle data at runtime using the particles API. For ropes, you also have access to elements which are strut/spring-like edges joining pairs of particles together.
let me know if I can be of further help,
kind regards