I made a little example with some kind of ceiling fan that is rotated randomly right from the start, and then should rotate along its own Y axis:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
<OnLoaded>
<SpawnModel Model="Model"/>
</OnLoaded>
<Content>
<Model Name="Model">
<OnSpawn>
<ZExpression>
<Expression>
<![CDATA[CurrentModel.RotationVelocity.Y = 0.5;
CurrentModel.Rotation = rnd();]]>
</Expression>
</ZExpression>
</OnSpawn>
<OnRender>
<RenderMesh Mesh="Mesh"/>
</OnRender>
</Model>
<Mesh Name="Mesh">
<Producers>
<MeshSphere/>
<MeshBox Scale="5 0.1 0.5"/>
<MeshCombine/>
<MeshBox Scale="0.5 0.1 5"/>
<MeshCombine/>
</Producers>
</Mesh>
</Content>
</ZApplication>
I also tried to avoid RotationVelocity and to use that in the model's OnUpdate:
Code: Select all
CurrentModel.Rotation.Y += 0.001;
How can I make the model to rotate on its own Y axis after a random rotation on all 3 axes right from the start?
I know I can do that using RanderTransformGroup, but the problem with that method is that the light with my shader don't take into account that transformation, so the shadow is rotating with the model...