mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 03:07:04 +02:00
feat: animation
This commit is contained in:
1 parent
199e156e53
commit
7af1fdcf6b
2 files changed
+185
-174
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { Euler, Quaternion, Vector3 } from 'three';
|
||||
import { J_HAT } from '../../constants/axis';
|
||||
|
||||
const quaternion = new Quaternion();
|
||||
const axis = new Vector3();
|
||||
|
||||
export function normalToEuler(normal: Vector3, up = J_HAT) {
|
||||
return new Euler().setFromQuaternion(
|
||||
quaternion.setFromAxisAngle(
|
||||
axis.crossVectors(up, normal).normalize(),
|
||||
up.angleTo(normal),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user