- Home /
 
               Question by 
               TerraCratis · Jan 16, 2015 at 11:02 AM · 
                shadermaterialuvoffset  
              
 
              Material offset relative to other game object
Hello, iam not really know how to explain what i need in english, so adding here some images. As you can see in in image 1 there is cube with texture, in image 2 i duplicated cube and draged it to left. But cubes material offset is 0; 0, so it not showing it right. What i want is in image 3 - that no matter where i put the cube, materials uv offset would be some global point (texture always in same place).
I tried to use
 renderer.material.mainTextureOffset = new Vector2 (center_object.transform.position.x-this.transform.position.x, center_object.transform.position.z-this.transform.position.z);
center_object is gameobject in scene, which serves as point zero, to make material offseting global, but textures still moving with cubes.

 
                 
                untitled-7.png 
                (110.0 kB) 
               
 
              
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                