Rotating tank turret. Animate is best?

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
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Rotating tank turret. Animate is best?

Post by suliman »

Hi
I have units such as tanks that has a body, and a turret that can rotate freely from the body. What is the best solution? Animate the turret in 3d max and in irrlicht set animation frame to whatever frame corresponds to the current "float turretRotation"?

Would that work? (Im using obj-files for my units right now). But if i need rotation AND elevation of the turret? I now got two parameters so its hard to animate for all combinations...

Another option is to save the parts in different model files and just manually place/rotate everything in irrlicht depending on turretRotation and turretElevation. But that makes it a bit unhadly with all the files, also wouldnt the drawCalls increase three times, making the game much slower/less optimized?

Thanks for your input
Erik
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Rotating tank turret. Animate is best?

Post by hendu »

Yes, three separate meshes with code control is best. Three times the drawcalls yes, but how many tanks will you have on screen?
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Rotating tank turret. Animate is best?

Post by suliman »

Maybe 50 units on screen. Will be different depending on the situation.

What is bad with the animation method?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Rotating tank turret. Animate is best?

Post by hendu »

150 draw calls is nothing really.

The infinite number of combinations is bad. Animating even a few hundred combinations is not the best use of RAM (or your time).
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Rotating tank turret. Animate is best?

Post by suliman »

but do models take up so much more space in ram if they have more animation frames?

For units that may elevate visually ALOT (AA guns for example) animation might be bad, but for units that are "fixed-angle" (firing ground-to-ground only such as anti-tank guns) i might only need 30 frames or something. But 30 frames only for 360 degree rotation may look jumpy...

I remember many drawCalls were mensioned as a bottleneck issue, but maybe thats when you have many hundreds of them (such as using meshes for trees/stones etc)
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Rotating tank turret. Animate is best?

Post by hendu »

Aim to have less than 1000 drawcalls per frame. Think of it like a budget. 150 for tanks, some for env...
Post Reply