Obi Official Forum
Help Best way to pre-bend this rod? - 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: Help Best way to pre-bend this rod? (/thread-4091.html)



Best way to pre-bend this rod? - bad.penny.games - 15-01-2024

I am using a rod as the hose on this vacuum cleaner. I want it to be curled like below when the scene loads. When I try to "pre-bend" the control points it goes wrong one way or another, usually by falling off the "start" transform.

Overall I would prefer to just snapshot the hose and current state in some way without having to edit control points (basically the way we do for physics objects in the scene, we hit Play, then we copy the transforms, then we "Paste -> component values" to have the object settle where it should be). So is there a one-or-two click way way to do this for an Obi Rod object?   thanks in advance -- ian


RE: Best way to pre-bend this rod? - josemendez - 15-01-2024

(15-01-2024, 07:17 PM)bad.penny.games Wrote: I am using a rod as the hose on this vacuum cleaner. I want it to be curled like below when the scene loads. When I try to "pre-bend" the control points it goes wrong one way or another, usually by falling off the "start" transform.

Overall I would prefer to just snapshot the hose and current state in some way without having to edit control points (basically the way we do for physics objects in the scene, we hit Play, then we copy the transforms, then we "Paste -> component values" to have the object settle where it should be). So is there a one-or-two click way way to do this for an Obi Rod object?   thanks in advance -- ian

Hi!

The intended way to do this is using the path editor. Note you can add a ObiParticleRenderer component to the rod, this will allow you to visualize the particles in the rod as you edit the path.

At each control point in the path, one particle is guaranteed to be placed, so by placing a control point right at the object’s transform you can make sure the rod doesn’t stray away from that transform.

If you want to use the “snapshot” method instead, you’ll need to write some code that generates a blueprint at runtime by saving current particle positions/orientations, and then stores it as an asset - to be used next time you want to instantiate the rod-. Let me know if you need help with this.

See:
http://obi.virtualmethodstudio.com/manual/6.3/scriptingactors.html
http://obi.virtualmethodstudio.com/manual/6.3/scriptingparticles.html

Kind regards,


RE: Best way to pre-bend this rod? - bad.penny.games - 16-01-2024

(15-01-2024, 08:50 PM)josemendez Wrote:
Quote:At each control point in the path, one particle is guaranteed to be placed, so by placing a control point right at the object’s transform you can make sure the rod doesn’t stray away from that transform.

OK... thank you, I had to experiment a lot but am getting good results with one or two additional control points, and with Decimation=0 and Smoothing=3. I set the shape in the Editor using the Obi path editor tool.

The only problem now is that the rod (vacuum hose) shears just past the start point as soon as I press Play. This happens with 3 or 4 control points and I've varied most of the other parameters but can't see the cause here. We need the orientation to be constrained at the drum end (i.e., it has to come out straight, or it looks nasty).

Can you suggest a fix for this?  Thanks       -- ian


RE: Best way to pre-bend this rod? - josemendez - 16-01-2024

(16-01-2024, 04:28 AM)bad.penny.games Wrote: The only problem now is that the rod (vacuum hose) shears just past the start point as soon as I press Play. This happens with 3 or 4 control points and I've varied most of the other parameters but can't see the cause here.
Can you suggest a fix for this?  Thanks       -- ian

It's hard to tell just from a static image, but possible causes for this are:
- Overlapping control points, or a single control point with incorrect tangent handles.
- Consecutive control points with opposite orientation. (Enable the orientation tool in the path editor to check the orientation of each control point).
- Rope attached very close to / inside a collider (the collider will push intersecting particles out, giving rise to similar looking kinks/bends).

(16-01-2024, 04:28 AM)bad.penny.games Wrote: We need the orientation to be constrained at the drum end (i.e., it has to come out straight, or it looks nasty).

Just enable the "constrain orientation" checkbox in the ObiParticleAttachment.


RE: Best way to pre-bend this rod? - bad.penny.games - 16-01-2024

(16-01-2024, 07:43 AM)josemendez Wrote: - Rope attached very close to / inside a collider (the collider will push intersecting particles out, giving rise to similar looking kinks/bends).

It was this - thank you!

I bought this great asset a year ago, imagining this specific use case. Now it is working very nicely.