Vineet Posted November 24, 2020 Share Posted November 24, 2020 hi everyone, i wanted the vfx explosion 3 to play at certain time ,how to do that as it just blasts at the start and dies off. Link to comment
silent Posted November 25, 2020 Share Posted November 25, 2020 Vineet AFAIK, you need only to enable this node at the required time for explosion to start play. You can do it from code. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Vineet Posted November 25, 2020 Author Share Posted November 25, 2020 thanks silent ,but will need to know how to code as i have no knowledge as of now. Link to comment
thomalex Posted November 30, 2020 Share Posted November 30, 2020 Hello @Vineet, I suppose you intend to spawn an explosion using the vfx_explosions_3 sample from the vfx add-on. This is a compound object consisting of several pre-set Particle Systems and saved as a Node Reference. Once enabled or loaded they emit particles (single-time blast). You can change the Delay value of each particle system for a certain time offset without coding. If you intend to implement some logic for enabling the explosion, check out our C# Component System-related resources: Using C# Component System C# Component Samples And videotutorials that show how to spawn a node reference: Video Tutorial: C# Component System Video Tutorial: How to Access Assets from C# Components Basically, you'll need a C# component responsible for spawn via the following code, for example: Spoiler public class Spawner : Component { public AssetLinkNode node_to_spawn; public vec3 spawn_position = vec3.ZERO; public float period = 3.0f; private float timer; private void Init() { timer = period; } private void Update() { timer -= Game.IFps; if (timer < 0) { spawn(); timer = period; } } private void spawn() { if (!node_to_spawn.IsNull && node_to_spawn.IsFileExist) node_to_spawn.Load(vec3.ZERO); } } Don't forget also to handle deletion of spawned objects. Thanks! Link to comment
Recommended Posts