Particles, and the Saving of their Emitters
by Netwyrm · in Torque Game Engine Advanced · 09/27/2008 (1:02 pm) · 5 replies
Let me preface this with the baldfaced statement that I may very well be missing the obvious.
That out of the way, I am wondering what the trick is to getting a particle emitter to save into the mission file, and then restart when the mission is reloaded. Please note that I'm not yet trying to change the emitter shape, color, or texture... just to get it to show up after insertion.
Here is what I have tried:
1) Entering the mission editor and hitting F12. This brings up a dialog, and starts a "crossbowsplash" emitter.
2) If this is changed to the "flames" emitter, a nice fireball effect is had. It's a little bright and rapid, but again, I'm not trying to alter that yet.
3) Moving the emitter with the position handles, to get the Save mission menu item to light up and saving.
4) Examining the mission file. No emitter appears.
Second method:
1) Entering the mission editor, pressing F4 to get the creator mode, and selecting "ParticleEmitter" from the mission subgroup.
2) Changing the emitter type to "flames" from the popup menu under the item detail. Again, the fireball is had.
3) Saving the mission with the Save menu item.
4) Now an entry is available in the mission file, thus:
However, when I reload the mission, no emitter is visible at the location where it was placed.
I'm not sure how to get the emitter to stick, nor can I find a tutorial in the TGEA documentation which came with the engine. Does it need to be stuck to something? I have a similar problem in Constructor where although I can place interior lights, they don't reliably save into the model file when it is closed and reopened at a later point. I suspect it's a matter of my sheer raw ignorance and ineptitude, but any, er, light which could be shed upon the matter would be most appreciated.
That out of the way, I am wondering what the trick is to getting a particle emitter to save into the mission file, and then restart when the mission is reloaded. Please note that I'm not yet trying to change the emitter shape, color, or texture... just to get it to show up after insertion.
Here is what I have tried:
1) Entering the mission editor and hitting F12. This brings up a dialog, and starts a "crossbowsplash" emitter.
2) If this is changed to the "flames" emitter, a nice fireball effect is had. It's a little bright and rapid, but again, I'm not trying to alter that yet.
3) Moving the emitter with the position handles, to get the Save mission menu item to light up and saving.
4) Examining the mission file. No emitter appears.
Second method:
1) Entering the mission editor, pressing F4 to get the creator mode, and selecting "ParticleEmitter" from the mission subgroup.
2) Changing the emitter type to "flames" from the popup menu under the item detail. Again, the fireball is had.
3) Saving the mission with the Save menu item.
4) Now an entry is available in the mission file, thus:
new ParticleEmitterNode(MyParticleEmitter1) {
canSaveDynamicFields = "1";
Enabled = "1";
position = "590.124 998.529 562.976";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "TestEmitterNodeData";
emitter = "FB_Flames_E";
velocity = "1";
};However, when I reload the mission, no emitter is visible at the location where it was placed.
I'm not sure how to get the emitter to stick, nor can I find a tutorial in the TGEA documentation which came with the engine. Does it need to be stuck to something? I have a similar problem in Constructor where although I can place interior lights, they don't reliably save into the model file when it is closed and reopened at a later point. I suspect it's a matter of my sheer raw ignorance and ineptitude, but any, er, light which could be shed upon the matter would be most appreciated.
About the author
My adventures in T3D are chronicled at http://www.worldofantra.com. Please be aware the subject is sword-and-sorcery, and the occasional bloody or bare body part may be in scope.
#2
I just reopened the mission, and indeed, the particle emitter has vanished from the Inspector panel--when I checked earlier, the mission was still running, and the particle editor had been appended to the end of the mission file when I copied out the statement concerning it, and it showed up as well in the Inspector panel list as an item.
Opening the mission file itself, however, the particle emitter code as shown above still lies within. However, it is not appearing as an object in the list of mission objects in the Inspector palette when the mission is launched and F11 is pressed.
I am not, however, running a stock 1.7.1. I have the AFX TGEA 1.7.1 running, with some of the bug fixes which have been announced to this forum added, and perhaps the rules are somehow subtly different on what it is I am to do to get the newly created particle emitters to "stick".
09/27/2008 (5:51 pm)
Thank you, Morrock, for responding to my question.I just reopened the mission, and indeed, the particle emitter has vanished from the Inspector panel--when I checked earlier, the mission was still running, and the particle editor had been appended to the end of the mission file when I copied out the statement concerning it, and it showed up as well in the Inspector panel list as an item.
Opening the mission file itself, however, the particle emitter code as shown above still lies within. However, it is not appearing as an object in the list of mission objects in the Inspector palette when the mission is launched and F11 is pressed.
I am not, however, running a stock 1.7.1. I have the AFX TGEA 1.7.1 running, with some of the bug fixes which have been announced to this forum added, and perhaps the rules are somehow subtly different on what it is I am to do to get the newly created particle emitters to "stick".
#3
According to my tests, your first method does not work in stock TGEA or AFX. It does append a ParticleEmitterNode to the end of the mission, but it references a "TestEmitterNodeData" ParticleEmitterNodeData datablock which does not exist outside of the particle editor.
I found that the second method, does work in both stock TGEA 1.7.1 and AFX for TGEA 1.7.1 but there is a wrinkle with the AFX version. The afxDemo does not define any ParticleEmitterNodeData and you need one in order to create a ParticleEmitterNode using the mission editor. If you create at least one ParticleEmitterNodeData somewhere, then you can use it in the mission editor just like in stock TGEA 1.7.1.
You may want to review your steps as attempts to use the first method may be preventing the second method from working. (just a theory)
09/27/2008 (6:26 pm)
I checked this out in both stock TGEA 1.7.1 and AFX for TGEA 1.7.1...According to my tests, your first method does not work in stock TGEA or AFX. It does append a ParticleEmitterNode to the end of the mission, but it references a "TestEmitterNodeData" ParticleEmitterNodeData datablock which does not exist outside of the particle editor.
I found that the second method, does work in both stock TGEA 1.7.1 and AFX for TGEA 1.7.1 but there is a wrinkle with the AFX version. The afxDemo does not define any ParticleEmitterNodeData and you need one in order to create a ParticleEmitterNode using the mission editor. If you create at least one ParticleEmitterNodeData somewhere, then you can use it in the mission editor just like in stock TGEA 1.7.1.
You may want to review your steps as attempts to use the first method may be preventing the second method from working. (just a theory)
#4
I repeated the steps of the first method below (just to assure myself that this is indeed what I have tried):
1) Launch build.
2) Select mission (the same used as before), with FX load filtering, host multiplayer and use datablock cache checkboxes deselected.
3) Hit F11 to enter editor.
4) Hit F12 to get the particle panel.
5) A "crossbow splash" appears, with id 5950.
6) Use the particle panel to change from "CrossbowSplashMistEmitter" to "FB_Flames_B". Assigned Particles changes to have "FB_Flames_P", and item 5950 turns into a fireball.
7) Hit F12 again to make the particle panel close, and return to "standard" editor.
8) Hit F3 to make sure the Inspector is the displayed palette.
9) Item 5950 shows up as a particle emitter node.
10) Use mouse to select fireball.
11) Check Save under File... greyed out.
11) Move fireball slightly with the gadget.
12) Save menu lights up under "File".
13) Save file.
14) Open mission file with Torsion. Scrolling to bottom, the text representing the fireball appears.
15) Close the Torsion editor.
16) Hit F11 to exit the mission editor.
17) Hit Esc and confirm Yes to exit mission file, then Exit to quit.
18) Relaunch build.
19) Hit F11 to enter editor.
20) Hit F3 to confirm Inspector.
21) Item 5950 is not present in the item list (and not present under another id... there is no particle emitter, visible or not, in the Inspector palette).
I thank you for your suggestion on creating a ParticleEmitterNodeData somewhere, and I will keep it forefront in mind while I bang my head against chapter 21 in Finney's TGE book. The question arose initially when I hit F12 and the "editor" panel first appeared--I dropped two on top of some poles on a model I had stuck in a test mission, and the resulting twinkle pleased me so much I wanted to get it to stick.
09/29/2008 (11:23 pm)
Thank you for the reply, Mr. Faust.I repeated the steps of the first method below (just to assure myself that this is indeed what I have tried):
1) Launch build.
2) Select mission (the same used as before), with FX load filtering, host multiplayer and use datablock cache checkboxes deselected.
3) Hit F11 to enter editor.
4) Hit F12 to get the particle panel.
5) A "crossbow splash" appears, with id 5950.
6) Use the particle panel to change from "CrossbowSplashMistEmitter" to "FB_Flames_B". Assigned Particles changes to have "FB_Flames_P", and item 5950 turns into a fireball.
7) Hit F12 again to make the particle panel close, and return to "standard" editor.
8) Hit F3 to make sure the Inspector is the displayed palette.
9) Item 5950 shows up as a particle emitter node.
10) Use mouse to select fireball.
11) Check Save under File... greyed out.
11) Move fireball slightly with the gadget.
12) Save menu lights up under "File".
13) Save file.
14) Open mission file with Torsion. Scrolling to bottom, the text representing the fireball appears.
new ParticleEmitterNode() {
canSaveDynamicFields = "1";
Enabled = "1";
position = "795.724 907.119 543.03";
rotation = "0 0 1 3.86762";
scale = "1 1 1";
dataBlock = "TestEmitterNodeData";
emitter = "CrossbowSplashMistEmitter";
velocity = "1";
};15) Close the Torsion editor.
16) Hit F11 to exit the mission editor.
17) Hit Esc and confirm Yes to exit mission file, then Exit to quit.
18) Relaunch build.
19) Hit F11 to enter editor.
20) Hit F3 to confirm Inspector.
21) Item 5950 is not present in the item list (and not present under another id... there is no particle emitter, visible or not, in the Inspector palette).
I thank you for your suggestion on creating a ParticleEmitterNodeData somewhere, and I will keep it forefront in mind while I bang my head against chapter 21 in Finney's TGE book. The question arose initially when I hit F12 and the "editor" panel first appeared--I dropped two on top of some poles on a model I had stuck in a test mission, and the resulting twinkle pleased me so much I wanted to get it to stick.
#5
09/30/2008 (12:13 am)
Would changing all instances of TestEmitterNodeData in game/tools/missionEditor/scripts/particleEditor.ed.cs to ParticleEmitterNodeData solve the problem? I haven't tried this yet. That datablock is referenced by objectBuilderGui.ed.cs.
Torque 3D Owner Morrock
The object constructor you show from your mission file looks as though it should work, when you reload your mission and enter the mission editor, can you still see your object, even if their aren't any particles being generated? Check the mission file and see if the node is still there.