I'm creating a game and i need my objects to point towards another object. so i do this:
for ( int i = 60; i < NUM_MONKS; i++ )
{
dbCloneObject ( i, 999 );
monk[i].x = ((dbRnd ( 6782 ))/100)-51.75f;
monk[i].y = -3;
monk[i].z = ((dbRnd ( 4950 ))/100)-20.11f;
monk[i].gotoX = monk[i].x;
monk[i].gotoZ = monk[i].z;
monk[i].dir = dbRnd ( 360 );
monk[i].distanceMoved = 0.1;
dbMakeObjectBox ( (400+i), 2, 0.4, 2 ) ;
dbPositionObject ( (400+i), (monk[i].x + ((dbRnd ( 40 ))-20)) , (monk[i].y+1), (monk[i].z + ((dbRnd ( 40 ))-20)) );
dbColorObject ( (400+i), dbRgb (255, 0, 0));
float difX = dbObjectPositionX(i)-dbObjectPositionX(400+i);
float difZ = dbObjectPositionZ(i)-dbObjectPositionZ(400+i);
dbPointObject ( i, dbObjectPositionX(400+i), dbObjectPositionY(400+i), dbObjectPositionZ(400+i));
dbYRotateObject ( i, dbRnd ( 360 ));
dbPositionLight ( 1, monk[i].x, 10, monk[i].z );
dbSetObjectSpecularPower ( i, 0 );
dbSetObjectAmbient ( i, 0 );
}
But my objects are not facing the other squares?!? Its driving me made, does anyone have any solutions? thanks!