diff --git a/GameEngine/src/main/java/gameEngine/GameEditor.java b/GameEngine/src/main/java/gameEngine/GameEditor.java index c32c83e..58ffd28 100644 --- a/GameEngine/src/main/java/gameEngine/GameEditor.java +++ b/GameEngine/src/main/java/gameEngine/GameEditor.java @@ -104,27 +104,37 @@ if (clickedEntity != null) { Transform transform = clickedEntity.transform; - float value = Float.parseFloat(newValue); - switch (transformType) { - case 0: - if (axisIndex == 0) transform.position.x = value; - if (axisIndex == 1) transform.position.y = value; - if (axisIndex == 2) transform.position.z = value; - break; - case 1: - if (axisIndex == 0) transform.rotation.x = value; - if (axisIndex == 1) transform.rotation.y = value; - if (axisIndex == 2) transform.rotation.z = value; - break; - case 2: - if (axisIndex == 0) transform.scale.x = value; - if (axisIndex == 1) transform.scale.y = value; - if (axisIndex == 2) transform.scale.z = value; - break; + try { + // 入力を解析して数値に変換 + float value = Float.parseFloat(newValue); + + switch (transformType) { + case 0: + if (axisIndex == 0) transform.position.x = value; + if (axisIndex == 1) transform.position.y = value; + if (axisIndex == 2) transform.position.z = value; + break; + case 1: + if (axisIndex == 0) transform.rotation.x = value; + if (axisIndex == 1) transform.rotation.y = value; + if (axisIndex == 2) transform.rotation.z = value; + break; + case 2: + if (axisIndex == 0) transform.scale.x = value; + if (axisIndex == 1) transform.scale.y = value; + if (axisIndex == 2) transform.scale.z = value; + break; + } + + // 変化を適用 + clickedEntity.transform = transform; + + } catch (NumberFormatException e) { + // 入力が不正な場合は何もしない + System.err.println("Invalid input for transform value: " + newValue); + field.copyDisplayedTextToCurrent(); } - - clickedEntity.transform = transform; } });