How do I simulate "realistic" tank movement?

0 favourites
  • 5 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • First off, hello! New member here

    And the question... how do I emulate tank's hull movement in top-down perspective?

    To sum it up, I need my tank to:

      Pivot on the spot by pressing A and D key, Accelerate forward when pressing W, Reverse when pressing D, and moving forward/backwards while turning should make the tank behave somewhat like a turning car, but with adjustable angle of turn.

    How do I achieve this?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Set up your object with "Car" and "Rotate" behaviors.

    For the car behavior, you'll want to turn off default controls. Set up your W and S to simulate "accelerate" and "brake".

    Set the rotate speed with A and D, one positive one negative. Make sure you have an "else" event after that sets speed back to 0, so when your keys are not down it stops rotating.

  • Thanks for the reply oosyrag !

    This method works, but I feel that the movement is still somewhat slidey, especially while turning. I need this to not happen.

    What I want to happen when I release the W or S key is that the "tank" stops moving almost immediately, with only a few... say 20 pixels of "slide distance".

    Another thing I'm still confused about in the Car behavior is the relation of "deceleration" and "brake" (or reversing?). What I mean is that I'm not sure how I can control my braking force so that it still take some time to decelerate when I release W/S key, but comes to full stop almost immediately upon pressing the opposite key (i.e. pressing S while moving forward (W) and vice versa). How do I make it like so?

    This is what I've tried so far. It controls like a tank, but it still doesn't move quite like a tank, if you know what I'm saying.

    I think at this point I should also mention that I want the movement to be a lot like a top-down version World of Tanks, or War Thunder.

  • I see what you mean, maybe we should scrap that idea then.

    Here's something I put together without any behaviors. I've added some constraints and used dt where I remembered to, so it should be fairly future proof. Hope you can modify it to suit your needs, or figure something out using it as a basis.

    https://www.dropbox.com/s/4aoihmvl0h4s1 ... .capx?dl=0

    I feel pretty sure there is a cleaner way to do this, but it is what I came up with off the top of my head. Maybe someone else can provide a better way.

  • Hello oosyrag, thank you again for the reply!

    This seems to work quite right. Though I'm still curious about the Custom Movement function. Perhaps this system could be done with that function and more, but of course I have to learn it first haha

    Thanks for the help oosyrag! If someone else has different approach to this problem, please do post it here! I'm always eager to learn

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)