Hello, I would like to know if Box2D could be used to simulate a 2D car, also, is it possible to use Box2D for a top-view system instead of side-view?, am I overlooking something or it differs somehow? (gravity wise...)
Aside from this, would it be possible to model a good car with Box2D?, by good I'm talking about slipping of the wheels, proper friction, perhaps a differential, etc.
Thanks!
Top view games should be possible by setting gravity to zero. Perhaps we would need a new friction model to resist all translation and rotation. We you need objects that leave the surface (2.5D)?
You should be able to do a vehicle, but you would need to write much of it yourself. Box2D would only provide the rigid body simulation and collisions. At some point I plan to add some vehicle features, like wheel joints, but that is a ways off.
Thanks Erin, so I take it I'll have to calculate some of the specifics by my own, but what about the basics, doable?.
Things such as differentials, gear-boxes, etc.. are relatively "easy" to implement and they have nothing to do with the rigid body system as you pretty much stated, yet - having a "toolset" (or the likes) of a library to handle this sort of things would be very nice, I think of it as an expansion library... I'm guessing people would eventually write their own anyway.
The thing is... Could I get a basic and credible simulation running without much "hacking" involved?
Would it be possible to implement wheels with the current system (in a top-view fashion) or it'll be too complicated?.
Thanks
I'm guessing you could do a simple vehicle very easily. Provide a motor/break force and apply a lateral damping force to keep the vehicle from sliding sideways.
But then again, it's all "cheap hacks". Don't get me wrong here, I'm after a fun implementation - nothing real, it's just that I'm already "hacking my way through" with a custom mini solver of my own...
Needless to say Box2D is a hundredth times more stable, faster and better than what I'm already using, I just don't see a point into using Box2D if it can't really provide me an edge regarding my car simulation.
It sure would ease my environment issues (having dynamic objects, reactions, collisions, etc) - But in this case, I don't see why a crappy particle-baser integrator (my code) wouldn't do a similar job (for a small amount of objects and interactions).
I'm not looking for proof, because I've seen Box2D in action and it's impressive. I just don't know if I should use it for this 🙁
Yeah, Box2D is mainly about stacking and joints right now. So it might not be your best choice if those features are not important.
❗ Yet I really like it, I've been thinking about using my own solver for the cars, and still use Box2D for everything else. Do you think that I could tell Box2D where my car/s is/are exactly and whats its/their direction in the world?.
Is it possible to tell it "look heres an object, by brute force it's here" instead of applying forces, etc?. Would it react fine or explode in time?.
🙂
You can do something like that by moving around an infinite mass body. But wouldn't you want your car to react to other bodies?
Quite often for vehicles, people will use a normal rigid body and apply custom forces to make it move like a vehicle.