# Implement a vehicle that can "turn on the spot".

 0 I have been working on a prototype game with tanks. I'm currently working on getting the motion of the tank working correctly. At the moment, the forward and reverse movement is working (reasonably well) using basic vehicle physics with 4 wheel colliders, but one of the features of a tank is that it can "turn on the spot" by rotating its "treads" in opposite directions. This is where I am having trouble. My initial attempt was to apply a motor torque on the left wheels in the opposite direction as the right wheels but apparently, the forces just cancel eachother out and the tank doesn't move. I've also tried to apply a angular torque to the tank's main body's rigid body, but the tank doesn't seem to rotate smoothly (I suppose it has something to do with the wheel colliders preventing the tank from moving sideways?) Another option might be (but I havn't tried this) to just rotate the tank's transform directly. I wan't to avoid this because as far as I know, this doesn't play nicley with the physics engine. Perhaps it works if the tank is sitting on a flat surface, but if it's on rough terrain, I might run into some problems. What I also want to try is to turn the WheelColliders 90 degrees (so front wheels turn +90 degrees and the back wheels turn -90 degrees) and apply a motor torque to get the tank to turn on the spot. If anybody has any suggestions as to how I can get a vehicle to "turn on the spot", I'd love to hear it! Thanks in Advance! more ▼ asked Feb 16 '10 at 10:30 AM Jeremiah 76 ● 3 ● 4 ● 11 Lipis 2.3k ● 10 ● 22 ● 48 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 I've done this using the technique that you described (although with more wheels - 8 on each side). You might find that if the sideways friction of the wheels is preventing the vehicle from rotating, you could actually angle the wheels to point in the direction of the rotation, so that they don't get dragged sideways. Because the wheelcolliders are invisible, you wouldn't have to see this 'fake' wheel turning. (Engage ASCII diagram mode!) ``````// when rotating: when driving straight: // // /####\ |####| // #### #### // #### #### // \####/ |####| `````` more ▼ answered Feb 16 '10 at 12:19 PM duck ♦♦ 41.4k ● 95 ● 152 ● 415 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 Hey, I'm working on the same but not working. Can you share your codes? Thanks! more ▼ answered Dec 29 '10 at 01:01 AM add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 you should turn left and right wheel colliders 90 and -90 and then accelerate. if wheel colliders are not good for your needs use sphere collider and rigidbodies and configurable joints. more ▼ answered Feb 16 '10 at 11:47 AM Ashkan_gc 9.3k ● 33 ● 56 ● 120 A very good suggestion. Jun 02 at 09:19 PM ikelaiah add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x1947
x102
x60
x28
x23

asked: Feb 16 '10 at 10:30 AM

Seen: 1785 times

Last Updated: Jun 02 at 09:19 PM