Hi, I am trying to make my car drive faster by increasing the engine force, but it ends up making my car do a wheelie and then flipping onto its back. I tried shifting the centre of mass, and also making the car lower down to the ground but the car still flips over.
Can someone help me fix this?
thanks,
r_bewick
vehicle flipping over with high engine force
-
Flix
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: vehicle flipping over with high engine force
Try adding a vertical impulse (every physic tick) proportional to the car speed, so that it keeps the car on the ground (you can choose to apply it in the direction of the chassis too... but if the car is sliding on its side it may be a problem...).r_bewick wrote:I tried shifting the centre of mass, and also making the car lower down to the ground but the car still flips over.
(Usually vehicles without raycasting suffer less from this problem, maybe because the mass of the wheels helps the chassis stability).
-
r_bewick
- Posts: 8
- Joined: Sat Nov 13, 2010 2:58 am
Re: vehicle flipping over with high engine force
Thankyou very much for the reply, Flix.
I am trying to make a semi realistic racing game where cars will have powerups and shoot eachother (kind of like mashed or micro machines 4), So cars may end up sliding on their sides a bit.
I took my vehicle code from the bullet vehicle demo. Do you think it would be better for me to add a vertical impulse or change my vehicle to not use raycasting? Is there an example of this?
thanks again,
r_bewick
EDIT:
I added the vertical impulse and all is well for my car, it can drive fast
The only problem is when I go over a jump it makes the car flip over its front. Is there a way to check if the wheels are on the ground, so it only applies the impulse when the back wheels are on the ground?
thanks
I am trying to make a semi realistic racing game where cars will have powerups and shoot eachother (kind of like mashed or micro machines 4), So cars may end up sliding on their sides a bit.
I took my vehicle code from the bullet vehicle demo. Do you think it would be better for me to add a vertical impulse or change my vehicle to not use raycasting? Is there an example of this?
thanks again,
r_bewick
EDIT:
I added the vertical impulse and all is well for my car, it can drive fast
The only problem is when I go over a jump it makes the car flip over its front. Is there a way to check if the wheels are on the ground, so it only applies the impulse when the back wheels are on the ground?
thanks
-
Flix
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: vehicle flipping over with high engine force
No, I think raycast vehicles are better for that kind of games (anyway there are examples of "wheeled" vehicles, here http://bulletphysics.org/Bullet/phpBB3/ ... it=vehicle and here http://bulletphysics.org/Bullet/phpBB3/ ... it=tenuity), but I would stick to raycast vehicles).r_bewick wrote:Do you think it would be better for me to add a vertical impulse or change my vehicle to not use raycasting? Is there an example of this?
Never tried, but I think some people may have already find a way to check it (maybe you can dig into the Bullet source code and see if there's something helpful about it). Or you can just apply the impulse in some local point of your chassis, so that it can keep a good balance while flying.r_bewick wrote:The only problem is when I go over a jump it makes the car flip over its front. Is there a way to check if the wheels are on the ground, so it only applies the impulse when the back wheels are on the ground?
-
Alkane
- Posts: 7
- Joined: Sat Jul 10, 2010 8:34 pm
Re: vehicle flipping over with high engine force
This is a weird issue, how much force are you applying for the car to have such a strange behavior ?
Btw, to retrieve informations about the wheels, you can use the getWheelInfo() method on the raycast vehicle, for example, to know if the wheel is in contact with the road you can use this code :
Take a look at this : http://docs.google.com/Doc?docid=0AXVUZ ... 4Zmo&hl=en it contains some really interesting informations about bullet vehicles.
Btw, to retrieve informations about the wheels, you can use the getWheelInfo() method on the raycast vehicle, for example, to know if the wheel is in contact with the road you can use this code :
Code: Select all
bool is_wheel_in_contact = m_raycastVehicle->getWheelInfo( wheel_number ).m_raycastInfo.m_isInContact