Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Advanced search

1408796 Posts in 68973 Topics- by 62871 Members - Latest Member: snozzd

October 04, 2023, 04:42:48 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Ideas for a car braking system using a physics engine
Pages: [1]
Author Topic: Ideas for a car braking system using a physics engine  (Read 1052 times)
Level 0

View Profile
« on: June 30, 2023, 03:52:16 AM »

Hi all!

I'm developing a car racing game, with 2D physics, using the library Box2d. I'm trying to implement a realistic car brake. For this purpose I used a FrictionJoint between the wheel and its pivot point (which also works as a suspension). When I apply the brakes, this joint applies friction, which tends to equalize the rotation between the wheel and the pivot point (which cannot rotate, so the wheel tends to stop). That's the behavior I was expecting, but sometimes it shows like an oscillating behavior, mainly when the wheel is almost stopping. It kind of go forward and backward, oscillating, which is not a realistic behavior for a braking system. Anyone maybe have already had a similar problem? Or have an idea why this happens and how can I solve this? Or any different idea I can implement this brake system for an individual wheel, using joints or something like this? I said I'm using Box2d, but I think ideas used in other physics libraries can also help here. Thanks in advance!
Level 10

View Profile WWW
« Reply #1 on: July 01, 2023, 12:28:29 AM »

If I were doing this I would just apply friction to the car's body as the breaking force rather than locking the wheels.

Another idea is that cars don't lock their wheels when you break, they just apply friction to the wheels that reduces their rotation over time. If you were to instantly lock the wheels at a high velocity a car would fall apart.

Pages: [1]
Jump to:  

Theme orange-lt created by panic