Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


tank movement

This topic is 5990 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m working on a tank combat game using Blitz3D. I know many of the discussions and solutions offered here are written for c++ and are mostly for those who are building an entire 3D (or 2D) game engine from scratch. In Blitz, it is able to create terrain and handle all the collision detection, etc... so it frees us amateurs from having to code all that stuff. But I do want to TRY at least to put in some amount of realistic code. I have a tank and each game frame can move it forward or back (in the +/- Z-direction) and/or adjust its orientation. I have written the code to place the 4-corners of the tread on the ground as the slope of the terrain changes. But what I would like to do is plug in realistic numbers for velocity, acceleration, rotation, etc... and have the tank behave believably. Ultimately, I''d like to be able to describe a tank type by weight, engineHP, length measurements such as tread length, etc... and based on all this be able to determine: 1) how quickly the tank can accelerate 2) maximum velocity of the tank 3) how terrain slope effects velocity 4) at some slope have the treads loose their grip and spin thus preventing the tank from traversing too steep a slope. There was another thread I found on here about tank movement started by Tac-Tics an answered very well by smilydon where the gist seemed to be that each tread would be treated and calc''d separately and the combined effect of each would influence the final velocity and turning of the tank. Thing is, this was based on 1) a 2D scenerio and 2) the need to figure out x,y''s. What I think I need instead is more just the magnitude of velocity values instead of direction as I can rely on Blitz to just move me "forward/backwards" and not have to calc an actual x,y. So I''m wondering if anyone could expand on this topic a bit. Part of it seems like it should be easier since magnitude is what is required and not coords. (Of course I would similarly just ask Blitz to "rotate" my model depending on the results of that calc too). But of course 3D and taking into account the effects of slope,gravity,and slippage adds to the complexity. Any help offered is much appreciated! thank you... Dave

Share this post

Link to post
Share on other sites
hmm, dont know if i can help, i am not an experts on tanks. Your summary of the movement i describe in that other post is correct, but you forget one thing. It describe the movement when assuming that the rotation also takes place during the change in position. So you should not tell Blitz to only move forward/backward, but also to move left/right as a consequence of the rotating. In that kinematic model i gave you can get these things by just assuming that the tank starts in the origin all the time. So take x,y, alpha = zero and the xnext gives you the forward/backward motion and the ynext the left/right. You are right that this is much simpler.....if your tank is facing the positive y-axis you should set alpha=pi/2 and then ynext indicated the forward/backward motion.

The slope thing is a bit more difficult, and i don't know if i remember it correctly from school. Let's try....
Assume you have a masse m on a slope with angle phi. Then the force of gravity Fg=m*g with g being 9.8. This force can be split into two vectors one perpendicular to the slope (like the normal of the surface the masse is standing on, but then pointing into the earth) and one tangential (this is the one we want).
The force along the slope is Ft=sin(phi)*Fg, which is the force that may pull your tank down. This is where the friction comes in (we did lot's of experiments with little blocks on slopes in school). The friction sets a certain threshold. If Ft is larger then this treshold then then the tank slips, the friction cannot hold it at its spot. In other wordt the treads slip (i do not see the need to make a difference between friction and slip).If the friction is below that treshold the robot keeps it's position.

Now the engine part....The engine has to apply a force on your tank to move it. The power of the engine indicates how much force it can supply withing a certain time frame. This means it sets a limit to the force it can apply. According to Newton F=m*a, where a is the acceleration you want to give your tank. If Fmax is the maximum then the maximum acceleration for a tank twice as heavy is twice as low. I don't know about real tanks but i think you can assume that the engine always applies maximum force until the target speed is reached.
If we now also consider the slope then downhill the acceleration is given by (Fmax+Fz)/m and uphill by (Fmax-Fz)/m. So downhill it will accelerate more and uphill you have a larger change to exceed the friction threshold. In 3D it may be a bit more difficult, because you have to consider your motion wrt the steepest direction of the slope (where Fz is pointing to). I guess the acceleration will be something like (Fmax-cos(theta)*Fz)/m, where theta is the angle between your motion direction and the steepest direction of Fz.....This all applies to seeing the tank as a point masse, so i do not know how to deal with differences in fricion at the two treads....

I found this website about tank simulations, which may be usefull.....
It has some specs of real tanks and maybe the links section has pointers to tutorials (i didnt check this).

Hope this helps...

Edited by - smilydon on February 23, 2002 1:35:58 PM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!