It looks like you're new here. If you want to get involved, click one of these buttons!
if(rotation == 0){
orxObject_SetRotation(cat, (orxMATH_KF_DEG_TO_RAD * 270));
}else{
orxLOG("%f ? %f", orxMATH_KF_DEG_TO_RAD * 180, rotation - (orxMATH_KF_DEG_TO_RAD * 90));
orxObject_SetRotation(cat, rotation - (orxMATH_KF_DEG_TO_RAD * 90));
}
if(rotation == 0){
orxLOG("0");
orxVector_Set(&selectedCell, selectedCell.fX, selectedCell.fY - 35, selectedCell.fZ);
}else if(rotation == orxMATH_KF_DEG_TO_RAD * 90){
orxLOG("90");
orxVector_Set(&selectedCell, selectedCell.fX + 35, selectedCell.fY, selectedCell.fZ);
}else if(rotation == orxMATH_KF_DEG_TO_RAD * 180){
orxLOG("180");
orxVector_Set(&selectedCell, selectedCell.fX, selectedCell.fY + 35, selectedCell.fZ);
}else if(rotation == orxMATH_KF_DEG_TO_RAD * 270){
orxLOG("270");
orxVector_Set(&selectedCell, selectedCell.fX - 35, selectedCell.fY, selectedCell.fZ);
}
Comments
Unfortunately you can't expect a float to be precisely one value after doing some math operations, it's simply unreliable.
Here's an excellent series on floating points and their properties, what we can rely on and what we should avoid, by Bruce Dawson: http://randomascii.wordpress.com/category/floating-point/
I'd recommend using an enum to track your orientation and then act upon your rotation based on that enum but not use the rotation itself to track the orientation.