Caterpillars
Caterpillars
I am making a tank with caterpillars,but don't know how to make texture go around the wheels.I gues I need texture UV manipulation.But how to do it?Any suggestions?
-
pinballwizard
- Posts: 67
- Joined: Wed Aug 02, 2006 1:47 am
This may not directly help you with the specifics of animating the texture, but see this thread for how to simulate a tank. It might give you some other ideas.elvman wrote:I am making a tank with caterpillars,but don't know how to make texture go around the wheels.I gues I need texture UV manipulation.But how to do it?Any suggestions?
http://q12.org/pipermail/ode/2006-September/020162.html
About the texture, I guess if you have it tiled across the tread mesh, then just slowly increase the u value (or v value, depending on the texture orientation), and the whole texture will move in the u direction (or the v direction if you increment v). Since your texture is tiled across the whole tread, the whole surface of the tread should appear to be moving.
You'll probably want to keep the u value between 0 and 1, e.g. your u value might be increasing like 0, 0.1, 0.2, ..., 0.9, then back to 0.0 again. But for testing you should be able to just add 0.1 to the u value continuously and see what happens (but the u value will eventually overflow).
It looks like from the IMesh you can get a pointer to the IMeshBuffer, from which you can get a pointer to the texture vertices, which you should then be able to change. I don't know if you have to lock/unlock buffers or something similar to change the texture coordinates.
I haven't done this myself so try it and let us know how it works
-
pinballwizard
- Posts: 67
- Joined: Wed Aug 02, 2006 1:47 am
It seems that you can manipulate the texture matrix in Irrlicht for texture animation. Much easier! http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=15632
Unfortunately, since the texture matrix is part of the texture, it is applied the same to everything that uses that particular texture. I think it should be pulled out of ITexture and treated just like the other IVideoDriver transforms.
Of course you could keep a copy of the texture matrix you want to use for a scene node and just before rendering it you could overwrite the one in the texture. Unfortunately this just adds duplicate data.
Travis
Of course you could keep a copy of the texture matrix you want to use for a scene node and just before rendering it you could overwrite the one in the texture. Unfortunately this just adds duplicate data.
Travis