fixed rotation
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user