Is it recommended to do scientific modelling in unity or should i write a standalone program

Hello Unity community,

At this moment i’m researching the possibility to simulate a technical process in unity. This process is about collisions and the plastic and elastic deformations this brings into a model. Since i want to use different models i thought that maybe unity could come in handy for my project so i can load different models into unity. I am aware that the unity physics engine is not capable of calculating the plastic deformation after collisions so my question is is it still an advantage to use unity or should i write a seperate program to develop a simulation. I’am a software engineer so wrtiting a seperate program wouldn’t be a problem either. I just want to know if unity can bring any advantages for my purpose or if it will bring disadvantages if used.

thanks in advance

I would not advise Unity for scientific modelling. For illustration of a scientific concept is another matter.

Unity3D is designed to be efficient for making games which means there are a lot of cutbacks in terms of accuracy and function in order that it is optimised for making a game run. For example Floating point error is actually quite high and the degree of accuracy is really low compared to a Modelling tool such as MatLab.

A lot of the physics simulation in Unity is Visually oriented. This means that it is not too important on a procedural level as long as the Visual outcome is smooth and looks within the realms of plausibility.
The Engine itself commands tick-rates etc and so a Physics simulation can be subject to varying timesteps, which is obviously the opposite of what is needed for modelling in a scientific way.

Unity3D’s implementation of PhysX does not allow you access to the PhysX API. The rigidbody implementation (and other things) were created using the PhysX API and the Final Result is what is included in the Unity engine, so its a hard coded implementation and is not subject to any tweaking whatsoever (Unity devs used PhysX to create Unity Physics and included it in their project when Building the Engine we use; in exactly the same way that we use unity’s API to make a game with which players dont get access to the Unity API). As a result the Physics is not designed to emulate the real world but its good enough for a Game World.

To use it as an Output for visuals would work however. You could, for example, use MatLab to perform calculations and output them to the Engine for visualisation. Of course these visuals are analogous and so may not be totally accurate, requiring Hack or Fix code to get what you want.

Unfortunately this is the nature of a Game Engine.

The things that make a game engine bad for simulation and modelling are some of the same reasons why buying a Geforce TITAN is NOT a good choice for developers.

It’s likely a big “it depends” as most things when considering any engine. Unity will provide you to easy access of C# .NET libraries (up to v2.0 - yeah it’s behind). Unity’s physics engine won’t be of a help (or hinderance) if your simulations already calculate the physics results needed.

This question also depends largely on how many objects you might be moving simultaneously. If it is a large amount (like over 500) then if you know what you’re doing writing your own engine may be more efficient. Unity provides things like particle systems and its physics engine to help improve performance for large numbers of moving objects.

However, Unity’s already made. You can likely jump in and set up the simulation in a few hours vs the time it might take you to write your own engine. So, it’s likely worth a try. I’d at the very least go through and just write the calculations out in some C# classes and do some performance diagnostics to see if the code is capable of running at the speed you need.

I use unity for some mathematical simulations (related to a game with lots of statistics and random numbers). I can tell you that Unity is great for logging data, creating controls and viewers. Unity is bad when you are running simulations that require millions of formulas and you want your results quickly.