Simple Animator never reaches the goal
Posted: Wed Apr 01, 2015 2:28 am
In the example, the model should remove itself when variable "Age" reaches 1 ("Age" grows via Simple Animator, it is reflected on the Model's scale). However, this never happens.
If the "Smooth" tickbox of the Simple Animator is turned on, it works as expected.
If the "Smooth" tickbox of the Simple Animator is turned on, it works as expected.
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FrameRateStyle="2" FixedFrameRate="60" NoSound="1">
<OnLoaded>
<SpawnModel Model="Floater"/>
</OnLoaded>
<Content>
<Model Name="Floater">
<Definitions>
<Variable Name="Age"/>
</Definitions>
<OnUpdate>
<AnimatorSimple Duration="1" AutoStart="255" Target="Age" ToValue="1"/>
<Condition Comment="Remove?">
<Expression>
<![CDATA[return
(
Age == 1
);]]>
</Expression>
<OnTrue>
<RemoveModel/>
</OnTrue>
<OnFalse>
<ZExpression Expression="CurrentModel.Scale = sin(Age/2*PI);"/>
</OnFalse>
</Condition>
</OnUpdate>
<OnRender>
<UseMaterial Material="PaintDot"/>
<RenderSetColor Color="1 0.502 0 1"/>
<RenderSprite/>
</OnRender>
</Model>
<Group Comment="Materials">
<Children>
<Material Name="PaintDot" Blend="1">
<Textures>
<MaterialTexture Texture="DotWhite" TextureWrapMode="1" TexCoords="1"/>
</Textures>
</Material>
</Children>
</Group>
<Group Comment="Bitmaps">
<Children>
<Bitmap Name="DotWhite" Filter="1">
<Producers>
<BitmapExpression>
<Expression>
<![CDATA[// Local variables
float X1, Y1, B, S;
// Distance from center ( per axis )
X1 = 0.5-x;
Y1 = 0.5-y;
B = 64/1; // 64 = BitmapSize | 2 = Anti-Aliasing bias ( in pixels )
pixel.A = B*0.5-sqrt(X1*X1+Y1*Y1)*B;
// Set RGB to white
pixel.R = 1;
pixel.G = 1;
pixel.B = 1;]]>
</Expression>
</BitmapExpression>
</Producers>
</Bitmap>
</Children>
</Group>
</Content>
</ZApplication>