How to make a wheel steer more realistically

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Ross
Posts: 2
Joined: Fri Jun 25, 2010 6:04 pm

How to make a wheel steer more realistically

Post by Ross »

Hello again !

And again I'm having a problem with my little racing project :oops:
I'm planing to adopt the controls of the game to a Steering Wheel, I already made tests to see if it work well, and it worked ok, just more deep things that not worked cause I yet not started to research how to do, but its has nothing to do with bEPU :P like acceleration by pression, force feedback and so.

But one of the most basic things is to make the wheel steer as the steering wheel steer. To not waste time I first started to see if it work using the keyboard, like:
If the a key are pressed then start to steer, and if its not, start returning to the default steer angle. Using the VehicleInput as basis I really couldn't figure out how to do this, because in my way of thinking the way that the code is in the input with a little bit of modification it have to work, but has not...

Its like the update only gets the variable that I pass to him and put the steer angle to that value, but not keep adding to the steer variable in the Wheel until it gets to the maximum steer angle(what is the effect that I want).
The code i'm using is that, its just the steering code, without the other side steering and the "de-steering":

Code: Select all

 
                if (keyboardInput.IsKeyDown(Keys.A))
                {
                    if ((vehicle.wheels[1].shape.steeringAngle > -maxTurnAngles) && (vehicle.wheels[3].shape.steeringAngle > -maxTurnAngles))
                    {
                    vehicle.wheels[1].shape.steeringAngle -= 0.1f;
                    vehicle.wheels[3].shape.steeringAngle -= 0.1f;
                    }
                }

Thanks already.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How to make a wheel steer more realistically

Post by Norbo »

The reason why that might not have been working is because of a previous line in the VehicleInput that sets the steering angles to zero.

The attached version of the VehicleInput class implements the smooth steering and desteering effects as a demonstration.
Attachments
VehicleInput.cs
(12.95 KiB) Downloaded 205 times
Post Reply