1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-23 13:24:11 +02:00

side grid snap

This commit is contained in:
syuilo
2026-04-21 14:28:27 +09:00
parent 3dcbfc0168
commit efaf7bdd95
2 changed files with 26 additions and 7 deletions

View File

@@ -576,3 +576,16 @@ export class Timer {
this.intervalIds = [];
}
}
export function getYRotationDirection(rotationY: number): '+x' | '+z' | '-x' | '-z' {
const angle = rotationY % (2 * Math.PI);
if ((angle >= 0 && angle < Math.PI / 4) || (angle >= 7 * Math.PI / 4 && angle < 2 * Math.PI)) {
return '-z';
} else if (angle >= Math.PI / 4 && angle < 3 * Math.PI / 4) {
return '-x';
} else if (angle >= 3 * Math.PI / 4 && angle < 5 * Math.PI / 4) {
return '+z';
} else {
return '+x';
}
}