In my game I have used the btRaycastVehicle for all of my vehicles, even the tanks. I would like to replace it with something else for the tank vehicles.
I am trying to use a hinge joint for the wheel connection to the chassis. Do anyone have any ideas for the treads? How will I keep the treads from slipping off of the track?
Creating a Tank in Bullet Physics
-
- Posts: 66
- Joined: Sun Jan 30, 2011 8:46 pm
Re: Creating a Tank in Bullet Physics
Maybe make a gear like wheel with the teeth being a set of cubes stuck in a circle on a cylinder for the wheels. It would have to be a compound shape.
The tread can then be a bunch of cubes linked together and put on this wheel....that would be simulating it exactly as its in real life...which will probably be very slow.
The tread can then be a bunch of cubes linked together and put on this wheel....that would be simulating it exactly as its in real life...which will probably be very slow.
-
- Posts: 66
- Joined: Sun Jan 30, 2011 8:46 pm
Re: Creating a Tank in Bullet Physics
I have been thinking more over this and I think the actual simulation would be a bit too tough to make it work in Bullet.
For simulating tracked vehicles like tanks what I would do is have multiple wheels, say 5 on each side. The wheels can be bounced up and down a rough terrain through simple ray casts from the wheel connection point just like the ray cast vehicle.
Now if the terrain has low friction ..say you are simulating a sandy terrain, then the tracked vehicle should be able to move over it rapidly. For this I would lay down a small thin track of static rigid bodies(cuboids) along the direction of the vehicle movement. The friction between these cuboids and the wheels would be high(so the wheels never slip on them). The trail of cuboids will act as a chain allowing the vehicle to proceed forward. It would start from slightly behind the vehicle and extend to some distance up front. They effectively serve as the chain links but they are not attached around the wheels like in a real tank. You can add links to the trail as the tank moves and delete links behind the tank as needed. It would be similar to paging large terrains in and out of the physics world.
You can just as easily use a triangle mesh because all thats truly important is simulating the behavior of the tank.
I am trying this now in a recreation of the lunar tank in the Tintin comics

For simulating tracked vehicles like tanks what I would do is have multiple wheels, say 5 on each side. The wheels can be bounced up and down a rough terrain through simple ray casts from the wheel connection point just like the ray cast vehicle.
Now if the terrain has low friction ..say you are simulating a sandy terrain, then the tracked vehicle should be able to move over it rapidly. For this I would lay down a small thin track of static rigid bodies(cuboids) along the direction of the vehicle movement. The friction between these cuboids and the wheels would be high(so the wheels never slip on them). The trail of cuboids will act as a chain allowing the vehicle to proceed forward. It would start from slightly behind the vehicle and extend to some distance up front. They effectively serve as the chain links but they are not attached around the wheels like in a real tank. You can add links to the trail as the tank moves and delete links behind the tank as needed. It would be similar to paging large terrains in and out of the physics world.
You can just as easily use a triangle mesh because all thats truly important is simulating the behavior of the tank.
I am trying this now in a recreation of the lunar tank in the Tintin comics


-
- Posts: 6
- Joined: Fri Mar 23, 2012 7:18 am
Re: Creating a Tank in Bullet Physics
Hi
Could you give some feedback on the result of you tank simulation?
Did your approach end up giving you realistic enough results?
Thanks
Could you give some feedback on the result of you tank simulation?
Did your approach end up giving you realistic enough results?
Thanks
-
- Posts: 10
- Joined: Thu Oct 08, 2009 6:57 pm
Re: Creating a Tank in Bullet Physics
So, I tried making a tank using hinge constraints and it worked OK. I just had a really hard time controlling the speed of the vehicle.
It seemed to go either very slow, then very fast. It was wacky and a little disheartening. I tried making a raycast tank instead, which was allot easier, however, it seemed that I had to plug in allot of magic numbers for it to perform a pivot turn. Also, sometimes, it would mysteriously go backwards. So, all in all, I think that the hinge constraint way of doing it makes the most sense, however, I just wish it had some better way to move the wheels, maybe something like the btRaycastVehicle::applyforce(). Any ideas?
It seemed to go either very slow, then very fast. It was wacky and a little disheartening. I tried making a raycast tank instead, which was allot easier, however, it seemed that I had to plug in allot of magic numbers for it to perform a pivot turn. Also, sometimes, it would mysteriously go backwards. So, all in all, I think that the hinge constraint way of doing it makes the most sense, however, I just wish it had some better way to move the wheels, maybe something like the btRaycastVehicle::applyforce(). Any ideas?