fixed rotation

This commit is contained in:
Cedric Beck
2024-12-08 20:42:57 +01:00
parent f4a224621e
commit a7850f7d43
2 changed files with 9 additions and 6 deletions

View File

@@ -305,16 +305,18 @@ private float getRotationMove(Vector3f prev, Vector3f next) {
private void movePieceRek(UUID uuid, int curIndex, int moveIndex){
if (curIndex == moveIndex) return;
curIndex = (curIndex + 1) % infield.size();
int nextIndex = (curIndex + 1) % infield.size();
PieceControl pieceControl = pieces.get(uuid);
NodeControl nodeControl = infield.get(curIndex);
NodeControl nodeCur = infield.get(curIndex);
NodeControl nodeMove = infield.get(nextIndex);
pieceControl.setRotation(getRotationMove(pieceControl.getLocation(),nodeControl.getLocation()));
pieceControl.setRotation(getRotationMove(nodeCur.getLocation(),nodeMove.getLocation()));
movePieceToNode(pieceControl, nodeControl);
movePieceToNode(pieceControl, nodeMove);
movePieceRek(uuid, curIndex, moveIndex);
movePieceRek(uuid, nextIndex, moveIndex);
}
/**
@@ -760,6 +762,7 @@ private <K, V> K getKeyByValue(Map<K, V> map, V value) {
* @param moveIndex the target index to animate the piece to
*/
public void movePieceAnim(UUID uuid, int curIndex, int moveIndex){
pieces.get(uuid).getSpatial().addControl(new MoveControl(
infield.get(curIndex).getLocation(),
infield.get(moveIndex).getLocation(),

View File

@@ -85,7 +85,7 @@ public Game() {
gameStatistics = new Statistic();
initializeDrawPile();
board = new Board();
die = new Die(2,1,6,2,1,3);
die = new Die(2,1,2,2,1,3);
}
/**