Game Development Community

BOOK: Create a Score Particle Effect (pg 57) not working.

by Rich Hudson · in Torque X 2D · 01/25/2009 (10:22 pm) · 15 replies

The Emission Arc base does nothing. I know in TGB there is a checkbox which enables this - but not sure how to do this in TXB, anyone know?

#1
01/26/2009 (7:56 pm)
Wow, this is very strange. I've been playing with the emission arc base on three particle emitters I have and with two of them change the emission arc definitely has the desired effect. The third one, for the life of me, I cannot get it to change a bit when I move the emission arc graph. At this point, all I can think is that there is some other setting on the emitter that is causing the emission arc to be ignored.

I know that's not too helpful so I'll point you to the TX Particle effect guide. It's under TX 2D -> Guides -> Particle Effect Guide. There's also a bunch of other info about the particle system in there.
#2
01/26/2009 (8:14 pm)
Do you have the UseEffectEmission property set on the T2DParticleEmitterData? When that property is true, the effect's emission is used rather than the emitter's.

John K.
www.envygames.com
#3
01/26/2009 (8:41 pm)
John not sure how to use that information, I don't see that property. Here is what I have (which works, the effect does everything I want it to except move upwards).

T2DSceneObject missEmitterTemplate = 
TorqueObjectDatabase.Instance.FindObject<T2DSceneObject>
("combatEmitterHeroMiss");

_missEmitter = (T2DParticleEffect)missEmitterTemplate.Clone();

TorqueObjectDatabase.Instance.Register(_missEmitter);

_missEmitter.Position = new Vector2(_sceneObject.Position.X, _sceneObject.Position.Y - 6.0f);
_missEmitter.PlayEffect(false);

#4
01/26/2009 (9:26 pm)
Your code looks great. Can you also post your particle effect definition in the .txscene file?

John K.
www.envygames.com
#5
01/26/2009 (9:59 pm)
<T2DParticleEffect name="combatEmitterHeroMiss">
            <CreateWithPhysics>false</CreateWithPhysics>
            <CreateWithCollision>false</CreateWithCollision>
            <ObjectType>
                <object objTypeRef="t2dParticleEffectType" />
                <object objTypeRef="objEffect" />
            </ObjectType>
            <Pool>false</Pool>
            <PoolWithComponents>false</PoolWithComponents>
            <IsTemplate>true</IsTemplate>
            <IsPersistent>false</IsPersistent>
            <Layer>12</Layer>
            <Size>
                <X>10.000</X>
                <Y>10.000</Y>
            </Size>
            <Position>
                <X>90.000</X>
                <Y>-65.000</Y>
            </Position>
            <Rotation>0</Rotation>
            <CollisionsEnabled>false</CollisionsEnabled>
            <Visible>true</Visible>
            <VisibilityLevel>1</VisibilityLevel>
            <FlipX>false</FlipX>
            <FlipY>false</FlipY>
            <SortPoint>
                <X>-0.025210</X>
                <Y>0.018519</Y>
            </SortPoint>
#6
01/26/2009 (10:01 pm)
<CurrentEffectData>
                <LifeMode>Stop</LifeMode>
                <Lifetime>0.990000</Lifetime>
                <Emitters>
                    <EmitterData>
                        <Name>HeroMissTextEmitter</Name>
                        <Material nameRef="Miss_SpriteMaterial" />
                        <MaterialRegionIndex>0</MaterialRegionIndex>
                        <FixedParticleAspect>false</FixedParticleAspect>
                        <FixedAreaAspect>false</FixedAreaAspect>
                        <FixedForceAngle>0</FixedForceAngle>
                        <ParticleOrientation>Fixed</ParticleOrientation>
                        <OrientationAngleOffset>0</OrientationAngleOffset>
                        <OrientationKeepAligned>false</OrientationKeepAligned>
                        <OrientationRandomArc>360</OrientationRandomArc>
                        <InitialAge>0</InitialAge>
                        <EmitterArea>Point</EmitterArea>
                        <ParticlePivotPoint>
                            <X>0.000000</X>
                            <Y>0.000000</Y>
                        </ParticlePivotPoint>
                        <AreaOffset>
                            <X>0</X>
                            <Y>0</Y>
                        </AreaOffset>
#7
01/26/2009 (10:02 pm)
<UseEffectEmission>true</UseEffectEmission>
                        <LinkEmissionRotation>false</LinkEmissionRotation>
                        <AttachPositionToEmitter>false</AttachPositionToEmitter>
                        <AttachRotationToEmitter>false</AttachRotationToEmitter>
                        <SingleParticle>true</SingleParticle>
                        <FirstInFrontOrder>false</FirstInFrontOrder>
                        <MaxAreaXBase>
                            <PrimaryKey>10</PrimaryKey>
                        </MaxAreaXBase>
                        <MaxAreaYBase>
                            <PrimaryKey>10</PrimaryKey>
                        </MaxAreaYBase>
                        <ParticleLifeBase>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>2.000000</PrimaryKey>
                        </ParticleLifeBase>
                        <ParticleLifeVariation>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </ParticleLifeVariation>
                        <QuantityBase>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>1.000000</PrimaryKey>
                        </QuantityBase>
                        <QuantityVariation>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </QuantityVariation>
                        <SizeXBase>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>2.000000</PrimaryKey>
                        </SizeXBase>
                        <SizeXVariation>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </SizeXVariation>
                        <SizeXLife>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>1.000000</PrimaryKey>
                            <Keys>
                                <Key>
                                    <Time>1.000000</Time>
                                    <Value>5.000000</Value>
                                </Key>
                            </Keys>
                        </SizeXLife>
#8
01/26/2009 (10:03 pm)
<SpinLife>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>1.000000</PrimaryKey>
                        </SpinLife>
                        <FixedForceBase>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </FixedForceBase>
                        <FixedForceVariation>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </FixedForceVariation>
                        <FixedForceLife>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>1.000000</PrimaryKey>
                        </FixedForceLife>
                        <RandomMotionBase>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </RandomMotionBase>
                        <RandomMotionVariation>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </RandomMotionVariation>
                        <RandomMotionLife>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>1.000000</PrimaryKey>
                        </RandomMotionLife>
                        <EmissionForceBase>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </EmissionForceBase>
                        <EmissionForceVariation>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </EmissionForceVariation>
                        <EmissionAngleBase>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </EmissionAngleBase>
                        <EmissionAngleVariation>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </EmissionAngleVariation>
                        <EmissionArcBase>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </EmissionArcBase>
                        <EmissionArcVariation>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>0.000000</PrimaryKey>
                        </EmissionArcVariation>
                        <RedChannelLife>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>1.000000</PrimaryKey>
                        </RedChannelLife>
                        <GreenChannelLife>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>1.000000</PrimaryKey>
                        </GreenChannelLife>
                        <BlueChannelLife>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>1.000000</PrimaryKey>
                        </BlueChannelLife>
                        <VisibilityLife>
                            <ValueScale>1</ValueScale>
                            <PrimaryKey>1.000000</PrimaryKey>
                            <Keys>
                                <Key>
                                    <Time>1.000000</Time>
                                    <Value>0.000000</Value>
                                </Key>
                            </Keys>
                        </VisibilityLife>
                    </EmitterData>
                </Emitters>
            </CurrentEffectData>
        </T2DParticleEffect>
#9
01/27/2009 (12:08 am)
Now we're talking... try changing the following in your XML and then save.

<EmitterData>
   [b]<FixedForceAngle>0</FixedForceAngle>[/b]
   [b]<UseEffectEmission>false</UseEffectEmission>[/b]
<EmitterData>
 
<FixedForceBase>
   <ValueScale>1</ValueScale>
   [b]<PrimaryKey>10.000000</PrimaryKey>[/b]
</FixedForceBase>

John K.
www.envygames.com
#10
01/27/2009 (12:20 am)
Okay, maybe some English to go with this...

The UseEffectEmission property (when true) means that the parent effect group is going to drive the particles' force and direction. This is usually set to true if an effect is mounted to another object, like a moving sprite. Setting to false means that the emitter will drive the particles' force and angle. Setting the FixedForceAngle property to 0 points upward (180 would point downward). Then, you need to actually give it some force and setting FixedForceBase to 10 gives the particles a nice nudge.

John K.
www.envygames.com
#11
01/27/2009 (12:28 pm)
Hmm still nothing, I even hard coded it in the code:

T2DParticleEmitterData data = _hitEmitter.CurrentEffectData.FindEmitterData(0);
                data.UseEffectEmission = false;
and nothing...
#12
01/27/2009 (12:56 pm)
Arrrrgghhh!!!!!

Okay, I'll put something together real quick for you to download and try out.

John K.
www.envygames.com
#13
01/27/2009 (1:07 pm)
This may not work for you since it's compiled against Torque X 3.0 - but the levelData.txscene file should work with any new StarterGame 2D project since it just uses the GG Logo.

www.envygames.com/share/SpriteFadeout.zip

John K.
www.envygames.com
#14
01/27/2009 (3:40 pm)
OK so yours worked like a charm - so I opened it in TXB to see what was different (XML was same) and the option which is hosing me is the "SingleParticle" option if set to true it will not move upwards...

this sucks b/c since I am showing a "Miss" or "Hit" per attack - I only want one..

Any ideas?
#15
01/27/2009 (5:47 pm)
NM I got it using Quantity of 1.0.