mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-15 22:32:13 +00:00
Merge pull request #175 from storytold/feature/fixed-camera-glitch
Fixed camera object rotation glitch by converting degrees to rads.
This commit is contained in:
2 files changed
+3
-3
No files matched your search
@@ -86,7 +86,7 @@ export class TransformClip {
|
||||
//if (this.step_frame < 0) { this.step_frame = 0; }
|
||||
//if (this.step_frame >= this.length) { return; } // Reached max frames.
|
||||
if (this.keyframes.length < 1) { return; } // If there are enough points in the scene.
|
||||
|
||||
|
||||
// Find the current and next keyframes based on time_frame
|
||||
let { currentKeyframe, nextKeyframe } = this.findNextNumber(this.step_frame);
|
||||
if (nextKeyframe != undefined && currentKeyframe != undefined) {
|
||||
@@ -123,9 +123,10 @@ export class TransformClip {
|
||||
if (this.keyframes.length > 0) {
|
||||
let first_pos = this.keyframes[0].position;
|
||||
let first_rot = this.keyframes[0].rotation;
|
||||
let first_quat = new THREE.Quaternion().setFromEuler(new THREE.Euler(THREE.MathUtils.degToRad(first_rot.x), THREE.MathUtils.degToRad(first_rot.y), THREE.MathUtils.degToRad(first_rot.z)));
|
||||
let first_scl = this.keyframes[0].scale;
|
||||
object.position.copy(first_pos);
|
||||
object.rotation.set(first_rot.x, first_rot.y, first_rot.z);
|
||||
object.rotation.set(first_quat.x, first_quat.y, first_quat.z);
|
||||
object.scale.copy(first_scl);
|
||||
this.step_frame = 0;
|
||||
}
|
||||
|
||||
@@ -520,7 +520,6 @@ class Editor {
|
||||
|
||||
switchCameraView() {
|
||||
this.camera_person_mode = !this.camera_person_mode;
|
||||
console.log(this.camera_person_mode);
|
||||
if (this.cam_obj) {
|
||||
if (this.camera_person_mode) {
|
||||
this.last_cam_pos.copy(this.camera.position);
|
||||
|
||||
Reference in new issue
Block a user