Obi Official Forum
Help ObiPathSmoother needd for chain renderer - 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 ObiPathSmoother needd for chain renderer (/thread-4022.html)



ObiPathSmoother needd for chain renderer - lacasrac - 02-10-2023

Hello,

I use a lot of obiPathSmoother.GetSectionAt(T).position
But how can I use it with a chainrenderer? As I saw there is no ObiPathSmoother..

Thanks


RE: ObiPathSmoother needd for chain renderer - josemendez - 03-10-2023

(02-10-2023, 03:56 PM)lacasrac Wrote: Hello,

I use a lot of obiPathSmoother.GetSectionAt(T).position
But how can I use it with a chainrenderer? As I saw there is no ObiPathSmoother..

Thanks

Hi!

Chains aren't smoothed because links in a chain are completely rigid.

You can use rope.GetElementAt(float mu, out elementMu) to retrieve an element at a normalized point in the rope, just like you do with GetSectionAt. You use it like this:

Code:
var elm = rope.GetElementAt(0.5f, out float elementMu);
var position = Vector3.Lerp(rope.solver.positions[elm.particle1], rope.solver.positions[elm.particle2], elementMu);

kind regards,


RE: ObiPathSmoother needd for chain renderer - lacasrac - 03-10-2023

(03-10-2023, 06:57 AM)josemendez Wrote: Hi!

Chains aren't smoothed because links in a chain are completely rigid.

You can use rope.GetElementAt(float mu, out elementMu) to retrieve an element at a normalized point in the rope, just like you do with GetSectionAt. You use it like this:

Code:
var elm = rope.GetElementAt(0.5f, out float elementMu);
var position = Vector3.Lerp(rope.solver.positions[elm.particle1], rope.solver.positions[elm.particle2], elementMu);

kind regards,


Thanks, this worked Sonrisa