Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | RadRx |
In our game, I set the location of an array of attacking ships:
var attacking = []
for i in range (att_ships)
var position = Transform()
--code to define x, y, and z ---
attacking.append(Vector3(x, y, z))
position = position.translated(attacking[i])
$Attacking.multimesh.set_instance_transform(i, position)
$Attacking.multimesh.set_visible_instance_count(att_ships)
The ships seem to display correctly, and the attacking array seems to correctly record their location.
However, later when the ship explodes, the ship disappears correctly, but the explosion particles go to the wrong place:
att_ships -= 1
$ExplosionSpatial.set_translation(Vector3(attacking[att_ships]))
$ExplosionSpatial/Explosion.set_emitting(true)
$ExplosionSpatial/Explosion2.set_emitting(true)
$Attacking.multimesh.set_visible_instance_count(att_ships)
I have read a bunch of documentation, have tried several alternative ways of moving spatial node, and have been staring at this for hours. What am I doing wrong?