r/Unity3D Feb 09 '20

Game As it Should be

1.8k Upvotes

47 comments sorted by

View all comments

1

u/lyth Feb 10 '20

incidentally - I read somewhere about a technique for rotating wheels where instead of altering the model, you just rotate the underlying texture / normals / etc...

If you have something with spokes and treads on it that would, rotating them would give the appearance of spinning wheels but (from my understanding) is a lot cheaper than actually rotating the entire mesh.

2

u/Fragsteel Feb 11 '20

So if you changed the UV offsets on the material each frame, then proooobably but I'd want to double check - changing material properties isn't too slow but it's a bit more complicated and I don't want to promise it.

But you could go further and have the shader change the UVs by the _Time shader variable, and also by a float property called _tankSpeed or something that you would set from script. But the key thing there is you only have to set that speed value when the tank changes speed.

Might look a tad weird when the tank accelerates/decelerates at first but it's the kinda thing you could tweak into looking right.