Vehicle problems + much more

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Danthekilla
Posts: 136
Joined: Sun Jan 17, 2010 11:35 am

Vehicle problems + much more

Post by Danthekilla »

Hey Norbo we are going well with our racing game but we are having just a few issues with the vehicle.

Mainly these things.

It is near impossible to get the car to not roll or slide (even with all the tricks like lowering Center of mass) it seems to always want to slide or roll.
Is there anyway to not have a 4 wheel drive car? I only want to accelerate the back 2 wheels on some cars and the front 2 on others.
We are currently using a mesh for the cars collision should we just use a box? Would it be easier to get working right?
The wheels always seem to be way more down that necessary so the car floats really high and if I lower the suspension length under 0.5 (which gets it looking better) the car is not driveable or jitters
What are good scales for the car in world units? We are currently using something like 2long 1wide 0.25high
Would scaling up the car and the world help?
Also at the moment the car we have tweaked has its wheels pop up and down (flicker) randomly to the max and min suspension heights.
The wheels also seem to move forwards and sideways on the car too whenever I steer them.

Also the cars performance on 360 is quite slow too :( and it looks like we may only be able to have 3-4 cars at a time (we were hoping for a minimum of 6 and preferably 8)

On a very positive note the actual rigid body physics in the engine are amazingly accurate and fast and they perform better than expected on 360 too :) simply amazing
Also I looked over the licence agreement you sent me and once we reach the alpha stage we will sign that and stuff if that’s ok with you?
Also if you wanted to look us up we are at www.2point0studios.com and we have sold 3 games on indie games and all of which have been on the top 10 downloads list for at least 3 weeks each (2 of them getting in the top 3) and we can't wait to start putting up some 3d games with 3d physics.

This is getting to be a big post and I must thank you for taking the time to read it (I’m you made it to here :) )

Also I know you are planning a vehicle re-write soon and maybe even in 0.11 if it doesn’t get pushed back. I just thought I should mention that it would get good use and I would be very grateful if you could at least try to get some of the vehicle update in (even if it was only some little tweaks to make it a bit more solid as I know it must be a very complex system) because I’m not entirely sure of how successful our game will be unless we have some good/solid/ vehicles that are responsive and have sharp turning.

Anyway if there is anyway that you could try to roll a little of the vehicle update into 0.11 we would be eternally grateful and I’m sure so would many others :)

But seriously some great work so far and you have the best physics engine that runs on XNA.
And get back to me about the contract signing (is it ok to leave to when we hit alpha in a month or so?)

Cheers
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle problems + much more

Post by Norbo »

It is near impossible to get the car to not roll or slide (even with all the tricks like lowering Center of mass) it seems to always want to slide or roll.
If you haven't already seen it, you may want to check out the example vehicle and information in this thread: http://www.bepu-games.com/forums/viewto ... ?f=4&t=547.

The trick is ramping up the sliding friction while stabilizing the rolling at the same time by keeping the body (and center of mass) well supported by the wheels. Once the frame is properly hanging from the wheelbase, you can get some very high sliding friction without any rolling behavior.
Is there anyway to not have a 4 wheel drive car? I only want to accelerate the back 2 wheels on some cars and the front 2 on others.
Yes; the vehicle accelerate method is just a convenience method that changes every wheel's public "acceleration" field. Instead of calling vehicle.accelerate each frame, you could directly adjust the two wheels' accelerations that you want.
We are currently using a mesh for the cars collision should we just use a box? Would it be easier to get working right?
For testing, it might be easier. If you mean a ConvexHull of a relatively simple collision mesh, the main difference is that the center position is simpler to deal with in boxes than ConvexHulls since a Box is a very simple shape. Positioning the wheels would be trivial for a box, while it may take a little tuning with a ConvexHull.

However, a CompoundBody of many triangles representing a collision mesh would be more difficult to deal with. In addition to having to tune the wheel positions, you may find that the inertia tensor is a little wonky since the mesh is just a hollow shell with arbitrarily varying density. It would also be significantly slower than a Box or a few convex hulls in a compound body due to the sheer number of entities involved.
The wheels always seem to be way more down that necessary so the car floats really high and if I lower the suspension length under 0.5 (which gets it looking better) the car is not driveable or jitters
I would suggest starting from the sample vehicle input in the above link and seeing if the jitter still happens, since it has pretty short, stiff suspension. If it does, there may be some scale issues with the environment.
What are good scales for the car in world units? We are currently using something like 2long 1wide 0.25high. Would scaling up the car and the world help?
That's a fairly reasonable size. 0.25 is on the small side, but it'll probably be fine. Scaling it up a bit wouldn't hurt anything either.
Also at the moment the car we have tweaked has its wheels pop up and down (flicker) randomly to the max and min suspension heights.
If the wheels' minimum positions are exposed, they might be touching geometry at their minimum position, forcing the wheel to retract (and then pop back out again once the obstruction has been cleared). There might also be some scale issues which are preventing the convex cast from seeing the ground at some points. You'd likely see this if you were trying to drive around on a large 'plane' mesh composed of two massive triangles.
The wheels also seem to move forwards and sideways on the car too whenever I steer them.
Are you using the wheel.worldMatrix? Is the graphics model centered properly (as in, the center of the model is aligned with the pivot point)? Does it look like the position of the wheel is one frame behind that of the vehicle? I'm not completely clear on what it looks like, so these are just a few guesses.
Also the cars performance on 360 is quite slow too and it looks like we may only be able to have 3-4 cars at a time (we were hoping for a minimum of 6 and preferably
This is something that does need to improve. The last pass at the vehicle was quite some time ago, and it's not a mature system yet. There should be quite a lot of low hanging fruit still as far as performance optimization goes.
On a very positive note the actual rigid body physics in the engine are amazingly accurate and fast and they perform better than expected on 360 too simply amazing
Also I looked over the licence agreement you sent me and once we reach the alpha stage we will sign that and stuff if that’s ok with you?
Also if you wanted to look us up we are at http://www.2point0studios.com and we have sold 3 games on indie games and all of which have been on the top 10 downloads list for at least 3 weeks each (2 of them getting in the top 3) and we can't wait to start putting up some 3d games with 3d physics.
Good to hear :)
Signing the license later is perfectly fine; it just needs to be taken care of before a game using BEPUphysics is released.
Also I know you are planning a vehicle re-write soon and maybe even in 0.11 if it doesn’t get pushed back. I just thought I should mention that it would get good use and I would be very grateful if you could at least try to get some of the vehicle update in (even if it was only some little tweaks to make it a bit more solid as I know it must be a very complex system) because I’m not entirely sure of how successful our game will be unless we have some good/solid/ vehicles that are responsive and have sharp turning.

Anyway if there is anyway that you could try to roll a little of the vehicle update into 0.11 we would be eternally grateful and I’m sure so would many others
I'll take that into consideration :)
The 'complete re-do' will have to wait until v0.12.0, partially because of time, and partially because of a few supporting features that don't exist in v0.11.0. That said, a first pass over the vehicle to speed it up and make it a little more usable should fit into v0.11.0 fairly comfortably.
Danthekilla
Posts: 136
Joined: Sun Jan 17, 2010 11:35 am

Re: Vehicle problems + much more

Post by Danthekilla »

Norbo wrote:If you haven't already seen it, you may want to check out the example vehicle and information in this thread: viewtopic.php?f=4&t=547.

The trick is ramping up the sliding friction while stabilizing the rolling at the same time by keeping the body (and center of mass) well supported by the wheels. Once the frame is properly hanging from the wheelbase, you can get some very high sliding friction without any rolling behavior.
The only problem is that even if we can get a good car feel using the center of mass then when the car leaves the ground if rotates all funny because the center of mass is wrong... (there will be lots of jumps in our game)
Norbo wrote:Yes; the vehicle accelerate method is just a convenience method that changes every wheel's public "acceleration" field. Instead of calling vehicle.accelerate each frame, you could directly adjust the two wheels' accelerations that you want.
Thanks its very good to know.

Also i should have menchined that i am using raycast wheels as we saw a 38% perfomance improvement with 4 cars over convex cast
Danthekilla wrote:I'll take that into consideration
The 'complete re-do' will have to wait until v0.12.0, partially because of time, and partially because of a few supporting features that don't exist in v0.11.0. That said, a first pass over the vehicle to speed it up and make it a little more usable should fit into v0.11.0 fairly comfortably.
Thats great to hear even if you could just give it a little speedup and stuff that would be awesome :)

And just so i know 0.11 is about a month away (obviosly assumeing that all gos well and there are no holdups)
Our first racing game (of 3) should be nearing compleation by then (the first one is the smallest) so thats great to hear too.

perhaps the wheels moving away from the car is because it is somehow one frame behind... and yes we use the wheel.worldmatrix to render them

Anyway keep up the great work :)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle problems + much more

Post by Norbo »

The only problem is that even if we can get a good car feel using the center of mass then when the car leaves the ground if rotates all funny because the center of mass is wrong... (there will be lots of jumps in our game)
It should be possible to tune the car to work without having the center of mass excessively far from the actual center. The sample vehicle in the VehicleInput.cs of that thread (http://www.bepu-games.com/forums/viewto ... ?f=4&t=547) should still rotate pretty naturally.

The goal isn't to put the center of mass below ground or way outside the vehicle's bounding box, but rather just low enough to simulate where a normal car's center of mass would be. In a normal car, the center of mass isn't halfway up the chassis; it's pretty low relative to the wheels. There might be a little bit of extra tuning involved since the vehicle doesn't have a sway bar, but overall it will be close.
And just so i know 0.11 is about a month away (obviosly assumeing that all gos well and there are no holdups)
Yep, that's the goal.
perhaps the wheels moving away from the car is because it is somehow one frame behind... and yes we use the wheel.worldmatrix to render them
If it is one frame behind, it may be that the vehicle body is being drawn using its internal state (internalCenterPosition, internalOrientationMatrix, internalWorldTransform...) instead of its buffered state (centerPosition, orientationMatrix, worldTransform). For this to matter though, the simulation would have to be running with useInternalTimeStepping = true. If it hasn't been turned on, this wouldn't cause the problem.
Post Reply