Obi Official Forum
Accessing material of chopped rope - 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: Accessing material of chopped rope (/thread-1409.html)



Accessing material of chopped rope - superdev - 05-10-2019

Hi there,

I am going through the docs and I amĀ unable to find a way to access rope material at runtime. Is it possible to change material / fade the chopped part of the rope ?


RE: Accessing material of chopped rope - josemendez - 05-10-2019

(05-10-2019, 05:38 PM)superdev Wrote: Hi there,

I am going through the docs and I amĀ unable to find a way to access rope material at runtime. Is it possible to change material / fade the chopped part of the rope ?

If by "material" you mean the renderer's material, you get it from Unity's MeshRenderer:
Code:
rope.GetComponent<MeshRenderer>().material;

You could set the alpha value to zero in the particle's color when they are torn, then reading the vertex color in your rope's shader. That would fade out vertices adjacent two a cut.