Search Unity

Panzer driving

Discussion in 'Works In Progress - Archive' started by TwinFox, Nov 10, 2013.

  1. TwinFox

    TwinFox

    Joined:
    Jan 9, 2009
    Posts:
    66
    I have been away from these forums for quite a while but recently got back into tinkering with Unity. I thought I'd share my current hobby project as I think there may be people out there who have interest in the subject.

    $TankShot1.jpg
    $TankShot2.jpg

    Pacifist edition - strictly driving.

    This is no Spintires but I am still fairly pleased in what I could achieve using Unity physics. The suspension has been built using PhysX components while the whole drivetrain is simulated separately with RK4. The wheel traction model is also custom but I might take another shot with WheelColliders.

    Some hints to driving: You will have to engage the steering brake to turn the tank properly. This can be a bit tricky as it is like steering a car using only the handbrake - expect to spin easily. The 1st gear has a very high gear ratio compared to the rest and should be used for climbing the hills. As the terrain is very uneven you will probably only be using 3 gears at most.

    I am still trying to figure out how to manage tank sliding on angled surfaces. With no access to PhysX internals I don’t really see a way to solve the problem and can only try and minimise the effects.

    I only did the coding, credits for art go to:
    - Torsten Heldmann for the PzII model (Free in Asset Store!)
    - Manufactura K4 for the scene (From the Nature Pack)
    - Sonory for the audio samples (Their sample diesel engine. Yes, I know panzers had petrol engines…)

    Link to webplayerl (~70 Mb)

    The controls are:
    W Accelerate
    S Brake
    A, D Release left and right steering clutches, respectively.
    Shift Engage steering brake (while pressing A or D)
    Q, E Shift down, up
    1-5 Change camera
    R Reset tank to start position
     
  2. Josh707

    Josh707

    Joined:
    Jul 12, 2012
    Posts:
    71
    Awesome job on this! Even though it's just driving I played around for about 20 minutes, it looks really good and the physics feel pretty accurate. I didn't really notice any sliding but I was also trying not to get the tank stuck or falling, so that could be why.

    Either way, good job!
     
  3. TwinFox

    TwinFox

    Joined:
    Jan 9, 2009
    Posts:
    66
    Thank you Josh for the kind words.

    I used a bit of a hack in the web player to minimise sliding on slopes: Whenever you apply the brakes a spring joint is created, anchoring the tank in place. It will still slide a small distance and then stop. However, as it is a point constraint the tank can start to rotate in some situations. It is true that the sliding is hardly noticeable while driving, but in tank games the player should be able to perform accurate long distance shooting from stationary vehicles and even small crawl can get frustrating.

    By the way, the web player has been updated with collisions added for the bigger trees. It is not possible to uproot the trees yet but at least they can be shaken.
     
  4. GeneBox

    GeneBox

    Joined:
    Nov 15, 2012
    Posts:
    480
    This is fun, a bit confusing at the start but it's great nonetheless!
     
  5. piluve

    piluve

    Joined:
    Mar 17, 2012
    Posts:
    158
    It is really cool i mean the UI is simple but show you lot of info and it is quite simple to control it .
     
  6. murkz

    murkz

    Joined:
    Dec 26, 2009
    Posts:
    19
    Thank you TwinFox, I really enjoyed driving the Pzr II around this tight little map. I like the controls very much, once I got used to them (5mins) it seemed very intuitive. A beautiful map and Pzr II model with great physics... Thank you!

    I look forward to more.

    Jeff