Physics Engine Development - C++ vs. OOP in Matlab

11 views (last 30 days)
Recently I've been interested in implementing a top-down physics engine for a group of differential robots, all inside Matlab. The thing is, there is a lot of additional computations that I want to do apart from the physics simulations asociated with the engine. However, after looking a little bit into it, its obvious that a physics engine will hog a lot of the computational resources available, in particular if you use object oriented programming to implement physical entities (Given that OOP in Matlab is relatively slow). A possible solution that came to mind was to code the physics engine in C++ and then import the .cpp file to Matlab. However, I don't know if this will result in a better performance or the possible performance gains would be undermined by the additional processing required to parse a .cpp file.
I tried a physics engine called "CapSim" and it runs too slow for my liking.
Thanks in advance!
  2 Comments
James Tursa
James Tursa on 9 Jul 2020
I suggest you code up a small C++ example that does something you will need and see how you like the performance. It is hard to advise you without knowing all of the things your physics engine will be doing.
Eddy Sanoli
Eddy Sanoli on 9 Jul 2020
Oh, sorry for not going into detail. The engine will handle collisions between multiple robots (Generally between 10 and 30 robots modeled as circles seen from above) and their environment (Mostly consisting of static obstacles and a few polygons that can be pushed around).

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!