Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Animating tank treads?

Discussion in 'Editor & General Support' started by trixor, Nov 19, 2010.

  1. trixor


    Jul 14, 2010

    Iv been fighting with animating som treads on my tanks, but i cant seem to find the right solution.

    I guess there are a few ways to do this, either by animating the matrial to "rotate" with the "rpm" of the track, but
    i would like to have a entire track with the wheels and everything acting as a real tank would.

    I have Cinema 4d to make the models, and ofcouse Unity3d to make the game.

    If i make a animation within Cinema4d, i can activate the animation in unity3d, but the track doesnt interact with the terrain.

    I hope somebody maybe has overcome this problem, and could tell me what they did?
  2. PiNPOiNT


    Oct 26, 2010
    I was playing around with tank treads, but havent got a full solution for you. I don't know how to make them dynamically react to the ground. However i've been successful making the the tank treads turn. I'm doing this in maya though, so i dont know about Cinma4D but the idea is the same.

    I used a script to create tank treads in maya. Basically you make a bunch of copies of each piece of a tread. Then attach them to a curve that is in the shape of your chain of your tank. Then animate them following along the path.
    after you bake out the model as an fbx, the animation will remain and you can control it just like any other animation.

    Next, you make a box collider and put that around the overall size of your treads, and let have the tank sit on top of the ground and let the treads dig into the round a bit to make it look more realistic, but dont put a collider on the treads themselves.

    hope that helps a bit.
  3. Paulius-Liekis


    Aug 31, 2009
    On Battlefield games tracks animations were made by scrolling track texture around track mesh (scroll speed depended on movement speed), you can do this by controlling Material.mainTexture.offset in Unity. Impacts to the ground were done by skinning track mesh to several special bones, which were pushed up down based on raycasts with the ground. If I would do it again, I would do the same.
  4. vegenarie


    Jan 5, 2011
    I would like to use Unity physics as movement should look more realistic if done well. I am trying to make a tank game using physics. I use configurable joins for the caterpillars and using force, though it works more or less, it get stuck sometimes and canterpillars get stretched too much sometimes, dont get them to to move naturally.
    Last edited: Nov 1, 2012
  5. Acelondoner


    Jul 27, 2012
  6. lupo


    Apr 4, 2009
    Thanks for the link, Acelonder. I checked out Digital's very cool physics-based tank treads - and they function pretty well on a flat, and crawling over simple boxes and such - but I added a terrain and took the tank over it and everything got super-slow - the tank tread physics were really struggling to deal with fairly simple terrain.

    I'm thinking it's not going to work so well for most people - so I'm thinking, Vegenarie, you have two choices:

    1. Have a physics-based tank action and keep the landscape it crawls over very simple, or
    2. Fake the tank tread action and spend your cpu cycles on goodies like AI, geometry, terrain, graphics, etc.
    Last edited: Feb 28, 2013
  7. Cobalt-9


    Nov 7, 2012
    I just stumbled upon this thread looking for someone who'd finally gotten tank treads right, and that physics-based tank is near perfect. As for the problem with the terrain, the physics material on the treads just needed to be adjusted with more friction, and I put a little more torque in the wheels for some extra power, and ended up with a pretty capable tank over hilly/mountain-ey terrains.
    snow802 likes this.