Triggers and ParticleEmitterNodes
by Ray Taylor · in Torque 3D Professional · 02/27/2011 (12:59 pm) · 2 replies
I'm trying to get Moses/Cloud/Lightning/Trumpets up on the mountain.
I have used the recent Waterfall resource to create a cloud using the "WaterfallAEmitter" on the top of a mountain with lightning coming down. I want the cloud and lightning to only be there when the player is close and enters the trigger.
new Lightning(testLightning) {
strikesPerMinute = "0"; //No strikes at first
strikeWidth = "0.5";
strikeRadius = "10";
color = "1 1 1 1";
fadeColor = "0.839216 0.796079 0.709804 1";
chanceToHitTarget = "0.5";
boltStartRadius = "1";
useFog = "1";
dataBlock = "DefaultStorm";
position = "-36.9338 61.8414 108.132";
rotation = "1 0 0 0";
scale = "30 30 40";
canSave = "1";
canSaveDynamicFields = "1";
};
new ParticleEmitterNode(FirstWaterFall20) {
active = "1";
emitter = "WaterfallAEmitter";
velocity = "0";
dataBlock = "WaterfallAEmitterNode";
position = "-29.8246 69.5746 124.793";
rotation = "1 0 0 180";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};
I have the "Lightning" starting with the trigger "onenter" and "onleave" by:
testLightning.setFieldValue(strikesPerMinute, 45); //enter
&
testLightning.setFieldValue(strikesPerMinute, 0); //leave
This works fine. I'm sure there is a better way though.
How to I get the Emitter to come on and off by the enter/leave of the same trigger?
I have triggered datablocks/animations fine but this is a little different.
I have used the recent Waterfall resource to create a cloud using the "WaterfallAEmitter" on the top of a mountain with lightning coming down. I want the cloud and lightning to only be there when the player is close and enters the trigger.
new Lightning(testLightning) {
strikesPerMinute = "0"; //No strikes at first
strikeWidth = "0.5";
strikeRadius = "10";
color = "1 1 1 1";
fadeColor = "0.839216 0.796079 0.709804 1";
chanceToHitTarget = "0.5";
boltStartRadius = "1";
useFog = "1";
dataBlock = "DefaultStorm";
position = "-36.9338 61.8414 108.132";
rotation = "1 0 0 0";
scale = "30 30 40";
canSave = "1";
canSaveDynamicFields = "1";
};
new ParticleEmitterNode(FirstWaterFall20) {
active = "1";
emitter = "WaterfallAEmitter";
velocity = "0";
dataBlock = "WaterfallAEmitterNode";
position = "-29.8246 69.5746 124.793";
rotation = "1 0 0 180";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};
I have the "Lightning" starting with the trigger "onenter" and "onleave" by:
testLightning.setFieldValue(strikesPerMinute, 45); //enter
&
testLightning.setFieldValue(strikesPerMinute, 0); //leave
This works fine. I'm sure there is a better way though.
How to I get the Emitter to come on and off by the enter/leave of the same trigger?
I have triggered datablocks/animations fine but this is a little different.
#2
trigger Enter & Leave : on and off work perfect.
FirstWaterFall20.setdataBlock(WaterfallAEmitterNode); //on enter
&
FirstWaterFall20.setdataBlock(Waterfall0EmitterNode); //on leave
Thanks for the quick reply, I was going to put: "Steve, are you out there?" on the last line of my original post but I didn't want to show favoritism. Thanks, btw and your Simple FPS Tutorial (12 parts) was great.
02/27/2011 (2:15 pm)
Perfect! Made second datablock with timeMultiple = 0; trigger Enter & Leave : on and off work perfect.
FirstWaterFall20.setdataBlock(WaterfallAEmitterNode); //on enter
&
FirstWaterFall20.setdataBlock(Waterfall0EmitterNode); //on leave
Thanks for the quick reply, I was going to put: "Steve, are you out there?" on the last line of my original post but I didn't want to show favoritism. Thanks, btw and your Simple FPS Tutorial (12 parts) was great.
Associate Steve Acaster
[YorkshireRifles.com]
datablock ParticleEmitterNodeData(TimeMultiple1Node) { timeMultiple = 1; }; datablock ParticleEmitterNodeData(TimeMultiple0Node) { timeMultiple = 0; };So here you have 2 datablocks, one of which is a "timeMultiple" of "1" - or 100% play speed, and one is "timeMultiple" of "0" or stopped. You'll get a slight console warning when you first load up but you can safely ignore it.