Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Pinandu |
I don’t understand this error
E 0:00:03:0381 Can’t change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead
servers/physics_2d/physics_2d_server_sw.cpp:416 @ area_set_shape_disabled()
SpecialFX.gd:21 @ make_variable_Explosion()
Bullet_Base_Script.gd:26 @ explode()
Bullet_Base_Script.gd:32 @ _on_Bullet_klein_Rot_body_entered()
I have a Bullet Node, if this Node hits a Enemy it make a explosion
func explode():
get_node("/root/Main/SpecialFX").make_variable_Explosion(global_position - Vector2(960,540), .1)
queue_free()
In my SpecialFX Node the Code looks like this:
extends Node
const Rummms = 17
const EXPLOSION = preload("res://Main/SpecialFX/Explos.tscn")
func make_variable_Explosion(pos, Radius):
var explosion = EXPLOSION.instance()
explosion.position = pos
explosion.Radius = Radius # Scale wird dafür benutzt, Default ist 1
get_parent().get_node("SpielAblauf/Schlachtfeld").add_child(explosion) # Die SpecialFX wird dem Object hinzugefügt
get_node("/root/Main/AudioPlayer").playSound = Rummms
this is the Explos.tscn code
extends RigidBody2D
var Lebenszeit = 60
var Radius = 1 setget set_Radius # Startwert des Explosionsradius
func set_Radius(radius):
Radius = radius
self.scale = Vector2(radius, radius)
#warning-ignore:unused_argument
func _process(delta):
Lebenszeit -= 1
if Lebenszeit == 0:
queue_free()
The RigidBody2D has 2 Nodes, a Partikel2D for the Explosion and a Collision Shape that i don’t use at the moment.
It looks like everything’s okay. I see the explosions, the size is fine.
But in the debugger are depending on the time hundreds of errors.
My English is not so good that i understand the Error, any Tips for me?
Maybe it’s an error in the Linux Version of Godot.
Pinandu | 2019-04-10 09:58
Ich kann die Zeilennummern jetzt nicht direkt Deinen Scripts zuordnen aber in SpecialFX.gd Zeile 21 geschieht wohl etwas, dass besser mit call_deferred()
ausgeführt werden sollte.
Du könntest mal probieren, die ganze Funktion mit call_deferred aufzurufen:
func explode():
get_node("/root/Main/SpecialFX").call_deferred("make_variable_Explosion",\
[(global_position - Vector2(960,540)), .1])
queue_free()
Oder eben nur den Aufruf in der bemängelten Zeile (welche auch immer das ist).
Die Doku zu call_deferred findet sich in der Referenz zu Object
:
Object — Godot Engine (3.1) documentation in English
– English –
Try to use call_deferred
to execute the function call in line 21 (whatever that is). Or try to call the entire function make_variable_Explosion
as call_deferred.
wombatstampede | 2019-04-10 12:40
Vielen Dank das wars.
Thanks a lot this fix the Error
get_parent().get_node(“SpielAblauf/Schlachtfeld”).call_deferred(“add_child”, explosion)
Muss man denn seit 3.1 alle add_child so machen?
Is it a must to add_child in this way?
p.s. Ich habe mir ein altes spiel angesehen, da tauchen diese Fehler auch auf,
was bedeutet dieser Fehler?
bei dieser Zeile z.B.
get_node(“Collision”).disabled = true
Pinandu | 2019-04-10 16:16