I have an object that is loaded and used as a visual object, and an object that is hidden, positioned in the same place of the visible object and used to handle collisions.
In this way I can instantiate the visible objects (they are models. X) and gain in speed Upload, instead of creating some copies.
Unfortunately, if the object used for the collisions is hidden, there is any collisions.
Is it normal or what?
I knew that even if I would delete the object used in SC_SetupObject, the collision remained.
In my case, the object still exists, it's just hidden.
Here some code.
Object used for collision.
dbMakeObjectBox(firstEnemiesBoxCollision,9,18,11);
for(int i=0; i<numEnemies; i++) {
if(i>0) {
dbCloneObject(i+firstEnemiesBoxCollision,firstEnemiesBoxCollision);
}
dbHideObject(i+firstEnemiesBoxCollision);
dbRandomize(dbTimer());
posX=dbRND(764);
dbRandomize(dbTimer());
posZ=dbRND(764);
posY=dbGetTerrainGroundHeight(terrain,posX,posZ);
dbPositionObject(i+firstEnemiesBoxCollision, posX, posY, posZ );
SC_SetupObject( i+firstEnemiesBoxCollision, groupEnemy, 2 );
}
Visible object
dbLoadObject("some.dbo",firstEnemies);
dbAppendObject("some1.dbo",firstEnemies,dbTotalObjectFrames(firstEnemies)+1);
dbAppendObject("some2.dbo",firstEnemies,dbTotalObjectFrames(firstEnemies)+1);
dbAppendObject("some3.dbo",firstEnemies,dbTotalObjectFrames(firstEnemies)+1);
dbAppendObject("some4.dbo",firstEnemies,dbTotalObjectFrames(firstEnemies)+1);
dbAppendObject("some4.dbo",firstEnemies,dbTotalObjectFrames(firstEnemies)+1);
dbLoadImage("some.dds",11);
dbTextureObject(firstEnemies,11);
for(int i=0; i<numEnemies; i++) {
if(i>0) {
dbInstanceObject(i+firstEnemies,firstEnemies);
}
else {
dbTurnObjectLeft(i+firstEnemies, 180);
}
dbFixObjectPivot(i+firstEnemies);
dbScaleObject(i+firstEnemies,1000,1000,1000);
dbPositionObject(i+firstEnemies,dbObjectPositionX(mobs[i].id),dbObjectPositionY(mobs[i].id),dbObjectPositionZ(mobs[i].id));
dbYRotateObject(mobs[i].id,dbObjectAngleY(i+firstEnemies));
}