Hello,
At first, please excuse my English because I'm French. I actuelement engineering school. During this year I make a computer project. So I choose to make a 3D tank game in XNA / C #. But after one month, I regret my management of physics. That's why I looked for a physics engine, and I found bepuphysics.
I looked at the sample engine, which does not suit me at all, because I think the management of tank unrealistic. After much testing I got was something quite realistic.
So I have several problems:
- My tank can climb very steep hills.
- I want to put a turret on the tank, but I do not know how. I first with compoundBody, but I can not seem to perform transformations on its compondBody. So I decided to make joints between the turret and the tank, but the result is not as expected. For the turret when it collides, makes strange movement.
Thank you in advance for your answers.
Tank physics
Re: Tank physics
If you are using the Vehicle class, the grip strength is probably too high, or perhaps the maximum drive impulse.- My tank can climb very steep hills.
I should note that, while I did create a tank-like example, the Vehicle isn't really entirely appropriate for creating tread-like control. You may find that it's easier to fine tune the control if you just use the Vehicle wheels for support, and then implement your own sliding friction and drive mechanism. It may not be quite as robust as the vehicle's solver-based friction, but such accuracy may not be needed.
Compound bodies are indeed made to be entirely rigid and immutable. Changing them generally requires reconstructing them (with a few exceptions).I want to put a turret on the tank, but I do not know how. I first with compoundBody, but I can not seem to perform transformations on its compondBody.
Could you create an example turret joint setup in a BEPUphysicsDemos demo so I can check it out?So I decided to make joints between the turret and the tank, but the result is not as expected. For the turret when it collides, makes strange movement.
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Tank physics
Ok so i did some pictures.
The first is to represent when my tank can climb very steep hills.
http://imageshack.us/photo/my-images/34 ... ction.png/
The second is to represent my bad connection
http://imageshack.us/photo/my-images/84 ... oints.png/
because a turret in a real tank can do this XD
And I join my file tankInput.cs so you just have to include it to the samples
EDIT :
Thanks for your help
The first is to represent when my tank can climb very steep hills.
http://imageshack.us/photo/my-images/34 ... ction.png/
The second is to represent my bad connection
http://imageshack.us/photo/my-images/84 ... oints.png/
because a turret in a real tank can do this XD
And I join my file tankInput.cs so you just have to include it to the samples
EDIT :
Thanks for your help

- Attachments
-
- TankInput.cs
- TankInput.cs modif
- (26.91 KiB) Downloaded 487 times
Re: Tank physics
This appears to just be excessive grip/drive strength, as mentioned. You could think of it like this: right now, the largest impediment to the tank's movement is its own mass and friction. Once it has sufficient strength to overcome those barriers, trivial things like 'cliffs' are no longer an issueThe first is to represent when my tank can climb very steep hills.

It can be hard to tune tanks properly because of all the competing constraints, but a starting point would be to reduce the maximum drive force. You'd probably need to also reduce the rolling friction as well to let it move more freely.
This will probably further necessitate changes to the turning variables since the lowered drive force probably won't be enough to overcome sliding friction. You may find that reducing the sliding friction strategically while attempting turns makes things easier.
I'm not sure what that represents; is the tank ramming the turret into the wall? In that case, a bit of joint error is expected. There are two reasons for this:The second is to represent my bad connection
http://imageshack.us/photo/my-images/84 ... oints.png/
because a turret in a real tank can do this XD
1) The tank and its turret are heavy relative to the default constraint configurations. Constraints can be thought of as springs with some default damping and stiffness. Larger forces will be able to pull further on the spring.
You can see the difference by either reducing the mass of the tank and turret, or by increasing the rigidity of the springs. For example, to increase a revolute joint's BallSocketJoint rigidity:
Code: Select all
axisJoint.BallSocketJoint.SpringSettings.DampingConstant *= 3;
axisJoint.BallSocketJoint.SpringSettings.StiffnessConstant *= 3;
2) The tank body itself is much heavier than the turret- a factor of 500 for the barrel, and 100 for the turret body- so it will have a hard time propagating the full stopping impulse to the tank. This is related to the 'mass ratio' problem: if a very heavy object depends on a light object in a constraint system, stability will suffer. You can also see this when the tank runs into light boxes on the terrain and causes them to squish. (A light object that depends on a heavy object, on the other hand, is perfectly fine.)
It is a good idea in general to keep mass ratios relatively tight. For most interactions, keeping things within a factor of 10 would be good. For a tank specifically, you may find that you don't care that it crushes other objects- after all, crushing things is rather tanklike- so the mass ratio could be larger.
(Mass ratio issues in collisions are handled quite a bit more gracefully in the latest versions, so it may be worth upgrading.)
Other than that, the tank turret seems to behave pretty much as expected within the latest version of the BEPUphysicsDemos.
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Tank physics
Okay for this, so it's very hard to seek thoses values and to have realistics tank mouvementNorbo wrote: This will probably further necessitate changes to the turning variables since the lowered drive force probably won't be enough to overcome sliding friction. You may find that reducing the sliding friction strategically while attempting turns makes things easier.
I understand thoses solutions but in reality, the turret of a tank is FIX, so it cannot move in anydirection ( exepct rotation on the free axis ).Norbo wrote: 1) The tank and its turret are heavy relative to the default constraint configurations. Constraints can be thought of as springs with some default damping and stiffness. Larger forces will be able to pull further on the spring.
You can see the difference by either reducing the mass of the tank and turret, or by increasing the rigidity of the springs. For example, to increase a revolute joint's BallSocketJoint rigidity:Note that having some softness to the springs is helpful for stability.Code: Select all
axisJoint.BallSocketJoint.SpringSettings.DampingConstant *= 3; axisJoint.BallSocketJoint.SpringSettings.StiffnessConstant *= 3;
2) The tank body itself is much heavier than the turret- a factor of 500 for the barrel, and 100 for the turret body- so it will have a hard time propagating the full stopping impulse to the tank. This is related to the 'mass ratio' problem: if a very heavy object depends on a light object in a constraint system, stability will suffer. You can also see this when the tank runs into light boxes on the terrain and causes them to squish. (A light object that depends on a heavy object, on the other hand, is perfectly fine.)
It is a good idea in general to keep mass ratios relatively tight. For most interactions, keeping things within a factor of 10 would be good. For a tank specifically, you may find that you don't care that it crushes other objects- after all, crushing things is rather tanklike- so the mass ratio could be larger.
(Mass ratio issues in collisions are handled quite a bit more gracefully in the latest versions, so it may be worth upgrading.)
And i don't understand this sentence, can you developpe ?Norbo wrote: Other than that, the tank turret seems to behave pretty much as expected within the latest version of the BEPUphysicsDemos.
Re: Tank physics
Yes, indeed it is; the Vehicle is designed for wheeled vehicles like a regular car, not a tank, so getting things fine tuned is far from easy.Okay for this, so it's very hard to seek thoses values and to have realistics tank mouvement
I would recommend keeping my previous suggestion in mind should it prove too hard to achieve the desired behavior through tuning:
You may find that it's easier to fine tune the control if you just use the Vehicle wheels for support, and then implement your own sliding friction and drive mechanism. It may not be quite as robust as the vehicle's solver-based friction, but such accuracy may not be needed.
Addressing the spring strength and mass ratios can make it substantially more rigid. However, even a real tank will have problems if it rams its turret into a steel wallI understand thoses solutions but in reality, the turret of a tank is FIX, so it cannot move in anydirection ( exepct rotation on the free axis ).

By that sentence, I just mean I didn't notice any other obvious issues while playing around with it, with the caveat that I was using the latest version of BEPUphysics. If you're using a different (older) version, you may see some behavior that I do not see in the newer version. The dll-only download is quite a bit outdated compared to the latest source.And i don't understand this sentence, can you developpe ?
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Tank physics
Code: Select all
BallSocketJoint.SpringSettings.DampingConstant *= 3000;
BallSocketJoint.SpringSettings.StiffnessConstant *= 3000;
Re: Tank physics
Given that the mass is about a thousand times higher than the standard range, it makes sense that it would take around a thousand times higher rigidity to accomplish a similar feel, so that is reasonable. If you end up reducing/tuning mass to stop mass ratio related issues later, you may want to reduce/tune the spring rigidity proportionally.
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Tank physics
Ok, thanks a lot men 
I'm going to do what you say to me.

I'm going to do what you say to me.