I’m trying to do a snake game in unity3D. i need some help with stretching or scaling an object along with its material(tileable). can it be done in unity. I need to scale the cube as it picks up the object with its material via scripting… can any one help pls???
I think you will want to make a prefab of the portion of the snake that gets bigger. I’m imagining that the snake gets longer as it eats objects, so making a prefab of a portion of the body would be your best bet I think. That way you can just instantiate the prefab when the snake eats something and to make the transition smooth, instantiate the prefab with the scale of the axis that gets bigger set to 0 and incrementally increase the scale of that axis at the same speed as you make room for the new portion of the snake. I’m assuming that your snake’s head and tail will stay the same size and therefore you won’t have to touch the scale of those, but just translate them away from each other as the new portion of the snake materializes.
You won’t have to worry about tiling as the prefab will take care of that.
BTW transform.lossyScale is Read only. You will have to use localScale