変数が最後にチェックされてからの仮想カメラの動きを計算するために、Javaでコーディングを行っています。より具体的には、以下のこのコード:
float movementX, movementY, movementZ;
movementX = (int) (camX - sectorSize[1]);
movementY = (int) (camY - sectorSize[2]);
movementZ = (int) (camZ - sectorSize[3]);
/*
* If the variable is below 0
* then get the absolute value
* of the movement since the
* last camera position.
*/
if (movementX < 0) movementX *= -1;
if (movementY < 0) movementY *= -1;
if (movementZ < 0) movementZ *= -1;
if (movementX > 60 || movementY > 60 || movementZ > 60)
{
//Reset the sector size to allow for new points,
//don't store to save memory (may be changed later).
sectorSize[0] = 0;
}
さらにコードが必要な場合は、お知らせください。ectorSize変数は、[0]値に0〜500、[1]値に前者のcamX、[2]値に前者のcamY、最後に[3]値に前者のcamZを格納します。camX、camY、およびcamZは、他のコード(表示されません)によって処理されます。整理整頓のために、問題のコード以外のすべてを削除しました。
このコードはそのまま動作しますが、毎回「if(a_int_value> an_other_value || etc)」と入力するのは少し面倒です。