- Home /
How to Extend/Extrude a Mesh
I couldn't think of the best way to word the title, so I apologise if it's misleading.
Basically I want to make a grapple, more specifically the extendible bit that stretches to the faraway object it attaches to.
At the moment I'm using a line renderer and a simple unlit texture, but it looks terrible. I pondered using a cylinder model and simply scaling in height, but that would stretch the texture. Is there either a better way to achieve what I want, or a way to dynamically tile the texture at the same rate that it's stretching?
At the moment this is the code I am using each update to stretch the line renderer:
// lerp from player towards target with grapple
float t = Mathf.InverseLerp(m_StartTime, m_EndTime, Time.time);
m_End = Vector3.Lerp(m_Start, m_Target, t);
m_Line.SetPosition(1, m_End);
Any help is appreciated.
Assu$$anonymous$$g your object has a single texture, you can set the texture using $$anonymous$$aterial.mainTextureScale.
http://answers.unity3d.com/questions/451647/how-to-stretch-my-scale-in-unity-3d.html
@Robertbu is correct. Alternately, if you can access the line's mesh's UVs, you can use nearly identical math to alter those.
Your answer
Follow this Question
Related Questions
Texturing Large Objects 0 Answers
[Texture] model's egdes 0 Answers
Unity won't load textures from a Maya File 0 Answers
Blood splatter PNG file flush with terrain? 1 Answer
Overlay text over multiple cubes 1 Answer