Skip to content

Commit

Permalink
fix(PropertyAnimation): space conversion (Orillusion#162)
Browse files Browse the repository at this point in the history
Fix parameters used for space conversion
fix rotate order from animation.
Rotate the angle of the duck 180 degrees
update submodule of public
  • Loading branch information
hellmor authored May 19, 2023
1 parent 8d7cde8 commit 4dd34a3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion public
Submodule public updated 1 files
+20,150 −1 json/anim_0.json
9 changes: 6 additions & 3 deletions samples/animation/Sample_PropertyAnimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Sample_PropertyAnimation {
async run() {
Engine3D.setting.shadow.autoUpdate = true;
Engine3D.setting.shadow.updateFrameRate = 1;
Engine3D.setting.shadow.shadowBound = 10;
Engine3D.setting.shadow.shadowBound = 20;
Engine3D.setting.shadow.shadowBias = 0.0001;

await Engine3D.init();
Expand All @@ -37,10 +37,13 @@ class Sample_PropertyAnimation {

// load external model
let model = await Engine3D.res.loadGltf('PBR/Duck/Duck.gltf') as Object3D;
this.scene.addChild(model);
let container = new Object3D();
container.addChild(model);
model.rotationY = 180;
this.scene.addChild(container);
model.scaleX = model.scaleY = model.scaleZ = 0.01;

this.animation = await this.initPropertyAnim(model);
this.animation = await this.initPropertyAnim(container);
this.animation.play(this.animation.defaultClip);

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/components/anim/curveAnim/AnimationMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export class AnimationMonitor {

if (hasQuaternion) {
let transform = this._target.transform;
Matrix4.getEuler(transform.localRotation, transform.localRotQuat, true, 'YXZ');
Matrix4.getEuler(transform.localRotation, transform.localRotQuat, true, 'ZYX');
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/anim/curveAnim/PropertyHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export class PropertyHelp {
};

static property_scale: any = {
'm_LocalPosition.x': -1,
'm_LocalPosition.x': 1,
'm_LocalPosition.y': 1,
'm_LocalPosition.z': 1,
'm_LocalPosition.z': -1,

'localEulerAnglesRaw.x': -1, //Deg2Rad(1),
'localEulerAnglesRaw.y': 1, //Deg2Rad(1),
Expand All @@ -59,9 +59,9 @@ export class PropertyHelp {
'm_LocalEulerAngles.y': 1, //Deg2Rad(1),
'm_LocalEulerAngles.z': 1, //Deg2Rad(1),

'm_LocalRotation.x': -1, //Rad2Deg(1),
'm_LocalRotation.x': 1, //Rad2Deg(1),
'm_LocalRotation.y': 1, //Rad2Deg(1),
'm_LocalRotation.z': 1, //Rad2Deg(1),
'm_LocalRotation.z': -1, //Rad2Deg(1),
'm_LocalRotation.w': -1, //Rad2Deg(1),

'm_LocalScale.x': 1,
Expand Down

0 comments on commit 4dd34a3

Please sign in to comment.