![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | ddabrahim |
Hi.
I’m using the Mono version of Godot 3.2 on Windows 10.
I have an object that consist of the following nodes
Area2D (root)
–CollisionPolygon2D
–sprite
I have 300 instances of this object in my game and I would like each instance to rotate, move around and I also would like to check collision with this object by sending and listening to a signal if anything enters the collision area which is a 2D polygon collision area.
The problem is that, even if this object do nothing but rotate, my game runs only at 5 FPS with 300 instances present in the scene. It doesn’t move and I don’t check collision but rotate it.
This is the code I’m using to rotate the instances:
this.Rotation -= rotationSpeed * delta;
The C# script is attached to the root (Area2D) node.
Only a single line of code doing nothing but rotate the object and I get only 5 FPS with 300 instances in the game. In similar scenario in other engines I get stable 60 FPS with even 1000 instances in the game and even if the instances are moving and do collision check.
I was searching the forum for optimisation and did read the docs but I can’t figure out what am I doing wrong and I have no idea how I could improve the performance in Godot. It is a very simple project also and it is surprise me it runs so badly with 300 instances.
I would appreciate any advice or links to articles regarding what to do different and what to look for when you dealing with lots of dynamic objects in Godot.
Thanks.
you don’t need “this.” at the beginning
Merlin1846 | 2020-02-02 19:48