Wheels and friction in different surfaces.

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
klomiken
Posts: 2
Joined: Sat May 12, 2012 9:57 am

Wheels and friction in different surfaces.

Post by klomiken »

Hi,
I am working on a little project using BEPU for the first time.
Based on the Vehicle Demo Project, I have created a vehicle with four wheels that runs over two surfaces.
The problem is that I would like to have different behavior on each surface, and I haven't been able to achieve that. The ground over the car runs are two big StaticMeshes. If I use

Code: Select all

this.collisionMesh.Material.StaticFriction = 0.0f;
this.collisionMesh.Material.KineticFriction = 0.0f;
MaterialManager.FrictionBlendMethod = PropertyBlendMethod.Min;
I expect the car to have no traction at all, but it has. In fact it has the same as if i leve it iat default values. Is this related to the fact that Wheels behave differently friction wise that other Entities?

Another posibility / question.

I am thinking about detecting which surface the wheel is colliding with so I can apply more sophisticated behaviors to the car (apply specific forces when the wheel rolls over certain ground and so on). How would one go around this? Collision Events on the Wheels?
Thanks in advance.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Wheels and friction in different surfaces.

Post by Norbo »

I expect the car to have no traction at all, but it has. In fact it has the same as if i leve it iat default values. Is this related to the fact that Wheels behave differently friction wise that other Entities?
Yup. It is assumed vehicles may want to use a different friction blending model, so each wheel has different friction blenders. They can be found in the wheel.SlidingFriction.FrictionBlender, wheel.DrivingMotor.GripFrictionBlender, and wheel.Brake.FrictionBlender.
I am thinking about detecting which surface the wheel is colliding with so I can apply more sophisticated behaviors to the car (apply specific forces when the wheel rolls over certain ground and so on). How would one go around this?
One relatively easy option is available in the development version: give the mesh.Material.Tag a value, make a custom friction blender for the wheels which analyzes the wheel.SupportMaterial.Tag, compute the friction based upon the wheel state and any information from the tag. Different zones of friction behavior could be defined through arbitrary volumes or by looking up the triangles involved in the collision and checking their vertex data for friction information (and other options :)).
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Wheels and friction in different surfaces.

Post by Norbo »

I should mention that if you want to do things unrelated to friction, the material tag trick I mentioned isn't really necessary- you can apply forces and all of that by examining the state of the vehicle and mesh in events if you want, or just by scanning the collision pairs list and acting upon its contents.
klomiken
Posts: 2
Joined: Sat May 12, 2012 9:57 am

Re: Wheels and friction in different surfaces.

Post by klomiken »

Thank you very much Norbo,

Defining new blender functions for the wheels definitely worked.

To detect which material the wheel is rolling over on, I'll play a little with both approaches you mention to see what can I do with each one.

Again, Thank you very much for the awesome answers.
Post Reply