wobbeling wheels of vehicle

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
grobi
Posts: 34
Joined: Wed Sep 23, 2009 5:47 pm

wobbeling wheels of vehicle

Post by grobi »

Hi,
I set up a vehicle which behaves quite good as long as the wheels stay on plain ground, if they leave the ground( are airborne) or stand on an oblique surface, they start wobbeling uncontralable (WheelFacingAngle still works) around till they reach a plain backgroound again. What could be the reason for that? Is it right that I gave the ConvexHull which is in the ConpoundBody which builds the Vehicle body a mass (100.0) and the wheels build from Cylinders don't have a mass?
Is there maybe a guide on how to simply setup a vehicle with BEPUphysics?

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

Re: wobbeling wheels of vehicle

Post by Norbo »

The wheels of a Vehicle are 'non physical' in that the entities are just used for their shape (when using ConvexCastWheels), so you don't need to worry about their masses.

The wobble could be purely graphical. Do you notice any bad physical behavior from the vehicle when the wheels look like they are wobbling? Are you using the wheel.worldMatrix property for rendering?

You can find an example Vehicle configuration in the BEPUphysicsDemos project VehicleInput class (http://www.bepu-games.com/BEPUphysics/downloads.htm). There's also another sample configuration in this thread for a more arcadey vehicle: http://www.bepu-games.com/forums/viewto ... ?f=4&t=547
grobi
Posts: 34
Joined: Wed Sep 23, 2009 5:47 pm

Re: wobbeling wheels of vehicle

Post by grobi »

I use :
FrontLeft
((ConvexCastWheel)vehicle.wheels[0]).wheelShape.orientationMatrix * vehicle.wheels[0].worldMatrix;
FrontRight
((ConvexCastWheel)vehicle.wheels[1]).wheelShape.orientationMatrix * Matrix.CreateRotationZ(MathHelper.ToRadians(180f)) * vehicle.wheels[1].worldMatrix;
RearLeft
((ConvexCastWheel)vehicle.wheels[2]).wheelShape.orientationMatrix * vehicle.wheels[2].worldMatrix;
RearRight
((ConvexCastWheel)vehicle.wheels[3]).wheelShape.orientationMatrix * Matrix.CreateRotationZ(MathHelper.ToRadians(180f)) * vehicle.wheels[3].worldMatrix;
as worldMatrices for rendering of the wheel models and :
vehicle.body.worldTransform as worldMatrix for rendering of the car model.
The weird thing is, its only happening when the tire is partially or fully airborne. as soon as they have flat contact, their back to normal.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: wobbeling wheels of vehicle

Post by Norbo »

You shouldn't need to rotate the wheel's world matrix. For example, in the demos, the rendering world matrices are set like this:

Code: Select all

wheelModels[k].worldMatrix = vehicle.wheels[k].worldMatrix;
If the wheel is set up properly, the wheel worldMatrix will include the other transformations (unless the display graphics need some additional offset). Try removing the extra transformations (the reference to the wheelShape's orientation matrix, specifically).

The setup for the vehicle is a little cantankerous right now (until v0.11.1), so I recommend building off of a pre-existing example like in the demos.
grobi
Posts: 34
Joined: Wed Sep 23, 2009 5:47 pm

Re: wobbeling wheels of vehicle

Post by grobi »

>wheelModels[k].worldMatrix = vehicle.wheels[k].worldMatrix;
You were right, it was just the graphics object which got screwed up, now it works!

thx again
Grobi
Post Reply