Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PropertyAnimation): space conversion #162

Merged
merged 4 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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