Caterpillars

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Caterpillars

Post by elvman »

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

Post by pinballwizard »

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?
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.

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

Post by pinballwizard »

It seems that you can manipulate the texture matrix in Irrlicht for texture animation. Much easier! http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=15632
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, simply set the rotations accordingly. It's even possible to change the rotation based on the current speed with just one command.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

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
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

IVideoDriver :? I would add another texture matrix to SMaterial to change matrices per Material. This allows to crop or rotate matrices globally (instead of in the loader) and per Material for different tiling or rotations things on separate meshes.
Post Reply