Hi Everybody,
Please help me here, How do you set some sort of identities to each spawned clone? I have 2 rows of pyramids of 4 clones each, I want to move the RotationVelocity.X Property of 1 and 8 and the Rotation.X of clones 3 and 6.
Set Identities to spawned clones
Moderator: Moderators
Set Identities to spawned clones
- Attachments
-
- Imagen2.png (71.35 KiB) Viewed 5547 times
Hi!
Sorry for taking so long to answer. I don't know if this is the best method, someone else will have to fill in otherwise, but it can be done this way :
In Definitions in your model you add a Variable, in this case called UniqueID. Then you can spawn models through code this way, and each will have an identity the others haven't.
If you wan't to spawn many you can set up a small loop or so. Hope this helps!
Sorry for taking so long to answer. I don't know if this is the best method, someone else will have to fill in otherwise, but it can be done this way :
In Definitions in your model you add a Variable, in this case called UniqueID. Then you can spawn models through code this way, and each will have an identity the others haven't.
If you wan't to spawn many you can set up a small loop or so. Hope this helps!
UniqueID = 1;
createModel(TriangleModel);
UniqueID = 2;
createModel(TriangleModel);
UniqueID = 3;
createModel(TriangleModel);
Hi guys,
There are a couple of ways to do that .. but i'd probably go with the following.
K
There are a couple of ways to do that .. but i'd probably go with the following.
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" CameraPosition="4.5 2 10">
<OnLoaded>
<ZExpression>
<Expression>
<![CDATA[//
for(int y=0; y<2; y++)
{
Pyramid.Position.Y = y*3;
for(int x=0; x<4; x++)
{
Pyramid.Position.X = x*3;
MyArray[(y<<2)+x] = createModel(Pyramid);
}
}]]>
</Expression>
</ZExpression>
</OnLoaded>
<OnUpdate>
<ZExpression>
<Expression>
<![CDATA[//
float s = sin(App.Time/8);
//
MyArray[0].RotationVelocity.X = s;
MyArray[7].RotationVelocity.X = s;
MyArray[2].Rotation.X = s;
MyArray[5].Rotation.X = s;]]>
</Expression>
</ZExpression>
</OnUpdate>
<Content>
<Model Name="Pyramid" Position="9 3 0">
<OnRender>
<RenderMesh Mesh="PyramidMesh"/>
</OnRender>
</Model>
<Mesh Name="PyramidMesh">
<Producers>
<MeshBox/>
<MeshExpression>
<Expression>
<![CDATA[//
if(V.Y > 0)
{
V.X = 0;
V.Y = 1.5;
V.Z = 0;
}
else
{
V.Y = 0;
}]]>
</Expression>
</MeshExpression>
</Producers>
</Mesh>
<Array Name="MyArray" Type="3" SizeDim1="8"/>
</Content>
</ZApplication>