SetColor in BaseModel
Posted: Sat Dec 03, 2016 5:09 pm
I have a few Enemy models which use the same BaseModel. The first part of the rendering is usually done in BaseModel, but in some cases the enemies have some additional elements that I'm trying to render using the same parameters as what was used in BaseModel.
Right now I have it set up like this (the SetColor is moved from OnRender to Definitions because it has to be unique for every Enemy that uses the same BaseModel):
I'd expect the model on the right to be flashing in both parts, but it only flashes in the bottom part - CallComponent (in the Model2 / OnRender) obviously calls the "original" SetColor, not the model-specific. Shouldn't it call its own SetColor, not the BaseModel's?
Right now I have it set up like this (the SetColor is moved from OnRender to Definitions because it has to be unique for every Enemy that uses the same BaseModel):
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" ClearColor="0.502 0.502 0.7529 1" FileVersion="2">
<OnLoaded>
<SpawnModel Model="Model1" Position="-3 0 0"/>
<SpawnModel Model="Model2" Position="3 0 0"/>
</OnLoaded>
<Content>
<Model Name="Model1">
<Definitions>
<RenderSetColor Name="setCol_Enemy" Color="0 1 1 1"/>
</Definitions>
<OnRender>
<UseMaterial Material="Material1"/>
<CallComponent Component="setCol_Enemy"/>
<RenderNet/>
</OnRender>
</Model>
<Model Name="Model2" BaseModel="Model1">
<OnUpdate>
<ZExpression Expression="setCol_Enemy.Color.R = round(frac(App.Time));"/>
</OnUpdate>
<OnRender>
<RenderTransformGroup Translate="0 2 0">
<Children>
<UseMaterial Material="Material1"/>
<CallComponent Component="setCol_Enemy"/>
<RenderNet/>
</Children>
</RenderTransformGroup>
</OnRender>
</Model>
<Material Name="Material1" Shading="1" Light="0" ZBuffer="0"/>
</Content>
</ZApplication>