Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | BigBackPack |
I have a simple 2D top down shooter with a static tower constantly shooting at me every 1.0 seconds. The bullit is a rigid body with a sprite and collision shape attached. On the bullet itself is also a script destroying the bullet after 5.0 sec. While playing everything works fine with 60fps until the first bullet starts to destroy itself. Suddenly the framerate drops down to 5 fps and gets back up after a view seconds.
I tried to find out what causes this issue: colliders and reducing the life of the bullets did not help. So far I got like up to 15 different bullets at highest. I can not believe that that amount of rigid bodies is already too much, is it?
Running on:
Win 10 64-bit
cpu = Intel(R) Core™ i7-4790K CPU @ 4.00GHz (8 CPUs), ~4.0GHz
gpu = NVIDIA GeForce GTX 970
Does this happen only when the first bullet is destroyed or when any bullet is destroyed?
omggomb | 2020-11-03 18:54
It starts with the destruction of the first bullets and goes on for quite a while till it gets better again. As far as I can tell the exact amount of bullets is not crucial for this to happen.
BigBackPack | 2020-11-03 20:54
If you alter the position of the bullets directly (e.g. position += something
) try switching them to a kinematic body and make sure to set the position inside physics_process
omggomb | 2020-11-05 19:49