Search code examples
c#unity-game-enginegame-physicsunityscriptphysics-engine

2 Wheeled Vehicles (Physics in Unity3D)


I'm trying to create a two wheeled vehicle in Unity3D, where the wheels are side by side (think a wheelchair or braitenberg vehicle). The intention is that if I drive one wheel, but not the other, the vehicle should turn. I should also be able to turn one wheel forwards and the other backwards and the vehicle should spin.

However, the vehicle generally just moves forwards (maybe with a slight bias in the direction I want to turn.. but only slight). I have a feeling I should change the drag/friction settings, but I have played with these with very little effect. Can anyone point me in the direction of what I should be doing to get this working right.

For info I am using the physics wheel colider built into unity 3D. I need to do this with physics so kinematic system would not be suitable.

Thanks


Solution

  • Ok, I'll add an answer here (although its my own question) as I have seen a couple of posts asking similar things. Even if you are creating a vehicle with 2 dominent wheels (like a little robot or a Britenberg vehicle) you should still add small wheels to the front or back for stability (think of them as casters). On these caster wheels, turn the stiffness factor for the forwards and sideways friction down to 0. On your main drive wheels, turn the sideways friction stiffness factor down to 0.5

    This allows the vehicle to skid steer.