Problem with vehicle wheels

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
lazy
Posts: 26
Joined: Tue Dec 08, 2009 2:56 pm
Location: stockholm, Sweden
Contact:

Problem with vehicle wheels

Post by lazy »

Hi

I hade tweaked my car so it worked almost exactly as I wanted... then I scaled everything a bit and now I've broken it =(

The car wheel behaves a bit weird when the car rolls. The wheels jump around a bit and force the car to move. They also move into the car.
I didn't see this before. Not sure what I can have done. I have no upright constraint enabled in this video.

http://www.scavenger.se/vehicle.wmv
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Problem with vehicle wheels

Post by Norbo »

It looks like the wheels are 'exposed.' The wheels are just convex objects being casted downward; if the car tips over and the wheels are too wide compared to the collision, the time of impact for the convex cast is 0 and the wheels get shoved upwards (and wiggly suspension forces are applied).

The recommended solution to this problem is to ensure that the convex cast's origin lies totally within the collision of the car so that it won't detect wheel supports when the car tips over.
lazy
Posts: 26
Joined: Tue Dec 08, 2009 2:56 pm
Location: stockholm, Sweden
Contact:

Re: Problem with vehicle wheels

Post by lazy »

Ok, so I have too high suspension length? or have the vehicle body too high up?
lazy
Posts: 26
Joined: Tue Dec 08, 2009 2:56 pm
Location: stockholm, Sweden
Contact:

Re: Problem with vehicle wheels

Post by lazy »

I've decreased the suspension length and moved the wheels more inside the body. and decreased the width. The 'chassiConnection' is now inside the body.
I get the same result =(


I've notices that the wheels move in the cars x axis. When the car is standing on a slope, the wheels are moved in the slope direction.

The image show the same car from two angles. The wheels are furhter inside the car on the high side of the slope.
Not sure if this has anything to do with the problem...
Attachments
car1.jpg
car1.jpg (79.66 KiB) Viewed 5302 times
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Problem with vehicle wheels

Post by Norbo »

Imagine the wheel pushed up all the way, as if the suspension length were 0. In your current car (ignoring the offset shown in the picture for now), does the wheel extend beyond the collision body anywhere? If so, the problem can persist. Even if the chassisConnection is inside the body, the wheel can still be exposed.

As for the offset of the picture, it looks like the graphics are just being attached to the wrong spot; I can't replicate it in the demos where the wheel graphics are positioned using their world transform:

Code: Select all

wheelModels[k].worldMatrix = vehicle.wheels[k].worldMatrix;
lazy
Posts: 26
Joined: Tue Dec 08, 2009 2:56 pm
Location: stockholm, Sweden
Contact:

Re: Problem with vehicle wheels

Post by lazy »

I just take the wheel world matrix and apply it on my wheel model just as you wrote.
In the video it is possible to see how the wheels sometimes are inside the body and somtimes outside. ( after 6 seconds )

these are my settings

Code: Select all

Vector3 SUSPENSION_DIRECTION = new Vector3(0, -1, 0);
            Vector3 FORWARD_VECTOR = new Vector3(0, 0, 1);
            float WHEEL_RADIUS = 1.0f;
            float WHEEL_WIDTH = 0.36f;
            float SUSPENSION_LENGTH = 0.7f;
            float SUSPENSION_CONSTANT = 180;
            float SLIDING_FRICTION = 20f;
            float ROLL_FRICTION = 0.5f;
            float GRIP = 5.5f;
            float MAX_SUSPENSION_FORCE = 12000;
            float SUSPENSION_DAMP = 0.97f;
I have a high gravity value of 0,-30, 0
The bodys mass is 350
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Problem with vehicle wheels

Post by Norbo »

By any chance are you offsetting the graphics of the car body directly upwards? That would look very similar.
lazy
Posts: 26
Joined: Tue Dec 08, 2009 2:56 pm
Location: stockholm, Sweden
Contact:

Re: Problem with vehicle wheels

Post by lazy »

Wow! You're good! Once again I'm totally embarrassed. Yes... I should have offsetted the graphics using vehicle.Body.worldTransform.Up! Maybe I should quit programming at 3am. ;)
Post Reply