I am doing an fps paintball game, so i want the bullets to be seen, and i want to use SC collisions to detect if any of them hits the oponent or the map... So i am doing this:
dbLoadObject("paintball.x", 300); //load bullet
dbHideObject(300);
while( LoopGDK ( ) ){
if (dbMouseClick()==1)
{
time2 = dbTimer();
if(time2 >= time + 100){ //create bullets each 100 ms
bullets_++;
dbCloneObject(bullets_,300);
SC_SetupObject(bullets_,1,1);
dbPositionObject( balas_,dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ() );
dbXRotateObject(bullets_,dbCameraAngleX(0));
dbYRotateObject(bullets_,dbCameraAngleY(0));
dbZRotateObject(bullets_,dbCameraAngleZ(0));
SC_UpdateObject(bullets_);
time = dbTimer();
}
}
else{
time = dbTimer();
}
//bullets collision with map
for(i = 301; i<=bullets_;i++){
if(dbObjectExist(i)) {
collide3 = SC_ObjectCollision(i, MAPA);
if(collide3){
SC_RemoveObject(i);
dbDeleteObject(i);
}
if(else) {
dbMoveObject(i,50);
dbLoopObject(i,1,24);
SC_UpdateObject(i);
}
}
}
}
My problem is that the collision sometimes is not detected and when it is, it gives the error: "Error during collision check: Object not setup"
The problem isnt the map, because i am using SC for slide collisions of my character.. Can you guys help me ?