I was doing a shooter game mockup and was implementing the fire property of the weapons.
Then I got huge lag spike when the "instance" method was called, even with call_defered.
This one is very easy de reproduce:
- Make a simple bullet scene containing only one Node of type MCGMesh with a Capsule mesh.
Make a main scene with the follow script :
onready var bullet_scene = preload("res://bullet.tscn")
func _input(event): if Input.is_action_just_pressed("ui_left"): bullet_scene.instance()
And you'll see that in the profileur the "Physic time" goes up to 200/300 ms with cause the lag spike
The work around is to use a CubeMesh instead of the Capsule Mesh.
Do you have any idea why it does that ??