How to use the @microsoft/mixed-reality-extension-sdk.Actor.CreateFromPrefab function in @microsoft/mixed-reality-extension-sdk

To help you get started, we’ve selected a few @microsoft/mixed-reality-extension-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / mixed-reality-extension-sdk-samples / samples / chess-game / src / app.ts View on Github external
private createCheckMarker() {
		const prefab = this.preloads['check-marker'][0].prefab;
		const actor = Actor.CreateFromPrefab(this.context, {
			prefabId: prefab.id,
			actor: {
				name: 'check-marker',
				parentId: this.boardOffset.id,
				transform: { local: { position: { x: 1, y: 999, z: 1 } } }
			}
		});
		this.checkMarker = actor;
		return actor.created();
	}
github microsoft / mixed-reality-extension-sdk-samples / samples / chess-game / src / app.ts View on Github external
private createChessboard() {
		const loads: Array> = [];
		this.chessboard = Actor.CreateFromPrefab(this.context, {
			prefabId: this.preloads['chessboard'][0].prefab.id,
			actor: {
				name: "chessboard",
				parentId: this.sceneRoot.id,
			}
		});
		loads.push(this.chessboard.created());

		this.boardOffset = Actor.CreateEmpty(this.context, {
			actor: {
				name: "board-offset",
				parentId: this.sceneRoot.id,
				transform: {
					local: {
						position: { x: 0.135, z: 0.135 }
					}
github microsoft / mixed-reality-extension-sdk-samples / samples / chess-game / src / app.ts View on Github external
private createChessPieces() {
		const loads: Array> = [];
		const status = this.game.getStatus() as Status;
		for (const square of status.board.squares) {
			if (square.piece) {
				const side = modelConfigs[square.piece.side.name];
				const info = side[square.piece.type];
				const name = `${square.piece.side.name}-${square.piece.type}`;
				const position = new Vector3();
				position.copy(this.coordinate(square));
				const prefab = this.preloads[`${square.piece.side.name}-${square.piece.type}`][0].prefab;
				const actor = Actor.CreateFromPrefab(this.context, {
					prefabId: prefab.id,
					actor: {
						name,
						parentId: this.boardOffset.id,
						transform: { local: { position, rotation: info.rotation } },
						subscriptions: ['transform']
					}
				});
				square.piece.actor = actor;
				loads.push(actor.created());
			}
		}
		return loads;
	}
github microsoft / mixed-reality-extension-sdk-samples / samples / chess-game / src / app.ts View on Github external
private createMoveMarkers() {
		const loads: Array> = [];
		const status = this.game.getStatus() as Status;
		for (const square of status.board.squares) {
			const position = new Vector3();
			position.copy(this.coordinate(square));
			position.y = 1000;
			const prefab = this.preloads['move-marker'][0].prefab;
			const actor = Actor.CreateFromPrefab(this.context, {
				prefabId: prefab.id,
				actor: {
					name: 'move-marker',
					parentId: this.boardOffset.id,
					transform: { local: { position } }
				}
			});
			square.marker = actor;
			loads.push(actor.created());
		}
		return loads;
	}

@microsoft/mixed-reality-extension-sdk

The Mixed Reality Extension SDK enables developers to build 3D world extensions for AltspaceVR, using Node.JS.

MIT
Latest version published 4 years ago

Package Health Score

50 / 100
Full package analysis