Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Transform subscription does not update the property being animated #716

Open
thespivey opened this issue Sep 9, 2020 · 0 comments
Open
Labels
V2 To be included in version 2

Comments

@thespivey
Copy link
Member

While animating the local position of an actor, a transform subscription only updates the app position.
When animating the app position, the subscription only updates the local position.

This quick repro does a animation of the local X position to 1, followed by an animation of the app X position to 2.
The logging reveals divergent values for app and local position, and indicates that only the non-animating value is being updated.

import * as MRE from '@microsoft/mixed-reality-extension-sdk';

export default class Repro {
	constructor(private context: MRE.Context, private baseUrl: string) {
		context.onStarted(() => {
			const assets = new MRE.AssetContainer(this.context);
			const box = MRE.Actor.CreatePrimitive(assets, {
				definition: {
					shape: MRE.PrimitiveShape.Box
				},
				actor: {
					name: "Box",
				}
			});
			
			box.subscribe("transform");

			const recorded = { app: 0, local: 0 };
			setInterval(_ => {
				if (box.transform.app.position.x !== recorded.app || 
					box.transform.local.position.x !== recorded.local) {
					recorded.app = box.transform.app.position.x;
					recorded.local = box.transform.local.position.x;
					console.log("app: " + recorded.app + " local: " + recorded.local);
				}
			}, 0);

			box.animateTo({ 
				transform: { 
					local: {
						position: { x: 1 }
					}
				}
			}, 5.0, MRE.AnimationEaseCurves.Linear).then(_ => {
				box.animateTo({ 
					transform: { 
						app: {
							position: { x: 2 }
						}
					}
				}, 5.0, MRE.AnimationEaseCurves.Linear);
			});

		});
	}
}

@thespivey thespivey changed the title Transform subscription does not update the animated property of a node transform Transform subscription does not update the property being animated Sep 9, 2020
@thespivey thespivey added the V2 To be included in version 2 label Sep 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
V2 To be included in version 2
Projects
None yet
Development

No branches or pull requests

1 participant