Motorcycle

ihar3d
Posts: 25
Joined: Wed Jan 23, 2008 11:28 am

Motorcycle

Post by ihar3d »

Hi All. Is there any way to make vehicle with 2 wheels (like a morcycle or bicycle) on base of btRaycastVehicle? I know that there are not any problems to create vehicle with different count of wheels, but with 2 it is unstable, and overturns during movement.
Thanks beforehand for the help.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Motorcycle

Post by sparkprime »

You probably need to simulate the gyroscopic effect of the wheels by applying torque to the body (about the axis defined by the two contact points of the wheels) proportional to but in the opposite direction of its angle away from vertical, with a damping factor to avoid oscillation. You will probably want to factor in the angular speed of the wheels as well as it should fall over when stationary. You also want to tilt it into the corners somehow.
rusty
Posts: 25
Joined: Fri Sep 19, 2008 10:23 am

Re: Motorcycle

Post by rusty »

The gyroscopic effect of the wheels tends to be quite minimal on most two wheeled vehicles, or so I've found. I have "simulated" motorbike's in the past, but at the time, I used a simple motor constraint in ODE to apply torque around the COM based on certain parameters, with the tire contacts generating the necessary opposing force to shift the COM.

My results weren't perfect though, so I've been giving another method some though, which is to determine the optimum lean angle and apply the forces based on that. So first, you need to know what the centrifugal acceleration is with;

A = (V * V) / R

V = velocity
R = turn radius
A = acceleration

So now you have the acceleration, you can to work out the lean angle from this. This is done with the relationship between the centrifugal acceleration force and the gravitational force (or weight) of the bike.

FA = (weight / g) * A
FG = weight

tan theta = FA / FG

or

tan theta = (V * V) / gR

So now can user the inverse tangent of theta for the desired lean angle. You can compare this to the current roll of the bike, and work out the force to apply at a certain point accordingly, each time step. I haven't gotten that far yet though, as it was just something I was thinking about; the actual implementation is left as an exercise for the reader ;)
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Motorcycle

Post by sparkprime »

I wonder how well it would work to use some kind of constraint to keep the motorbike oriented correctly? I have no idea which constraint though.
ihar3d
Posts: 25
Joined: Wed Jan 23, 2008 11:28 am

Re: Motorcycle

Post by ihar3d »

Thanks a lot for ideas, will try to implement somethink.