A 'for' Problem
Posted: Fri Jul 31, 2009 8:25 am
I loaded an object [square-like model] and copied it 9 times into the memory using GDK. What I'm trying to do is position that object, something like this:
But I can't do it right.
Here's what I tried so far:
Attempt1:
Attempts2:
Any ideas what am I doing wrong?
But I can't do it right.
Here's what I tried so far:
Attempt1:
Code: Select all
for(WorldObjects = 1; WorldObjects <= 9; WorldObjects++)
{
for(SizeX = 1; SizeX <= 3; SizeX++)
{
for(SizeZ = 1; SizeZ <= 3; SizeZ++)
{
dbPositionObject(WorldObjects,dbObjectPositionX(WorldObjects)+SizeX,dbObjectPositionY(WorldObjects), dbObjectPositionZ(WorldObjects)+SizeZ);
}
}
}
Code: Select all
float offset=0.35;
int i;
int j;
..........................................................................
for(WorldObjects = 1; WorldObjects <= 9; WorldObjects++)
{
for(i=0;i<3;i++)
{
for(j=0;j<3;j++){
dbPositionObject(WorldObjects,0+offset*i,0,0+offset*j);
}
}
}