Hi Community,
My character hase to shoot a rope. I thought about using a cylinder as rope because it will be taut (do you say it like that in english?) all the time. For the right length I would scale it on the local y-axis. But I want to be able to texture it. My question is how can I contoll the “procedural-texture-mapping” (how often the texture is set), so that my texture never looks scratched?
i think I know that it is somewhere in materal section but I cant find it…
(I hope my english isn´t too bad )
Thanks…
Since you’re shooting a rope, you have a start and an end point. Divide the length by the distance one rope texture “piece” should have and you get the scale factor.
Vector3 start = new Vector3(1, 2, 3); // just a random value
Vector3 end = new Vector3 (4, 5, 6);
float tileDistance = 2; // 2 world units per tile
void Update()
{
float length = (start-end).magnitude;
float numTiles = length/tileDistance;
// scale the texture along the y axis
rope.renderer.material.mainTextureScale = new Vector2 (1, numTiles);
}