DIGITAL LIBRARY
STUDENT RESEARCH PROJECT ON PHYSICAL SIMULATIONS IN UNITY3D GAME ENGINE
Lublin University of Technology (POLAND)
About this paper:
Appears in: INTED2017 Proceedings
Publication year: 2017
Pages: 7209-7214
ISBN: 978-84-617-8491-2
ISSN: 2340-1079
doi: 10.21125/inted.2017.1670
Conference name: 11th International Technology, Education and Development Conference
Dates: 6-8 March, 2017
Location: Valencia, Spain
Abstract:
The paper presents results of performance analysis of Unity 3D game engine focusing on the aspect of physical simulations using rigid body objects. Main aspects of the analysis is testing performance of CPU on the aspect of rendering and work of built-in PhysX physics engine. The aim of the paper is to determine how efficiently Unity 3D handles the aspect of physical simulations depending on the usage of different number of rigid bodies and complexity of their colliders. The research was conducted by team of teachers and students from Lublin University of Technology as a part of the 3D graphic seminar project.

Nowadays computers are capable of rendering advanced graphics and simulating law of physics existing in the real world, which is widely used in gaming and animation industry, science, etc. Performance is still very important factor in developing 3D applications. While scientific simulation or animated movies are usually rendered with usage of very efficient hardware like cloud computing, computer games is kind of 3D applications which must run smoothly even on average user’s computer or mobile. Since conducting simulation which features high quality visuals and real-time physics simulation requires efficient hardware, optimizing application’s performance and knowledge of limitations are key factors every developer needs to be aware of.

The paper focuses on performance aspect of physical simulations in application built with Unity 3D engine and discusses what aspects of simulation is essential of performance. The simulation consists of several collision test of rigid bodies in certain amount of time and measuring frame rate and overall time spent by CPU on physical calculations and rendering graphics.

Dedicated Unity3D application was developed to perform the analysis. The application consists of simulation which scenario is following –the quickly flying sphere rigid body hits the tower made of rigid body objects. The contact of sphere and tower initiates series of collisions in short period of time, leading to eventual tower’s destruction. Several application mechanics, e.g. initiating simulation, resetting back to initial state and measure application’s frame rate have been created with C# which is used as scripting language for Unity3D.

The simulation was conducted using different types of objects forming the tower - crate with simple box collider and abstract shape with irregular collider. Each type of the object is tested with a different number of its instances used - 100, 500 and 1000 respectively. The performance was measured on three aspects – time spent by CPU on physical calculations, rendering with use of the Profiler tool which is integral part of Unity3D.

Conducting performance analysis showed that Unity 3D is capable of keeping performance at reasonable level while handling physical interactions below 1000 rigid bodies with regular and simple collision shape. Simulation cases using objects with more complex collider caused several performance problems for 500 and, especially, 1000 objects. For the latter, in critical moment, frame rate decreased to 2 frames per second making further conducting simulation almost impossible.

Important conclusion is that apart from using reasonable amount of rigid bodies, key factor of performance is also object’s mesh complexity and shape of collider. The more complex collider, the higher amount of calculations physics engine needs to perform resulting in higher overhead.
Keywords:
Student project, rigid body, collision, collision detection, collider, performance, Unity 3D, game engine.