How to use the @microsoft/mixed-reality-extension-sdk.Actor.CreateFromGLTF 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 / hello-world / src / app.ts View on Github external
// The name is a unique identifier for this animation. We'll pass it to "startAnimation" later.
            "Spin", {
                // Keyframes define the timeline for the animation: where the actor should be, and when.
                // We're calling the generateSpinKeyframes function to produce a simple 20-second revolution.
                keyframes: this.generateSpinKeyframes(20, Vector3.Up()),
                // Events are points of interest during the animation. The animating actor will emit a given
                // named event at the given timestamp with a given string value as an argument.
                events: [],

                // Optionally, we also repeat the animation infinitely. PingPong alternately runs the animation
                // foward then backward.
                wrapMode: AnimationWrapMode.PingPong
            });

        // Load a glTF model
        const cubePromise = Actor.CreateFromGLTF(this.context, {
            // at the given URL
            resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
            // and spawn box colliders around the meshes.
            colliderType: 'box',
            // Also apply the following generic actor properties.
            actor: {
                name: 'Altspace Cube',
                // Parent the glTF model to the text actor.
                parentId: this.text.id,
                transform: {
                    position: { x: 0, y: -1, z: 0 },
                    scale: { x: 0.4, y: 0.4, z: 0.4 }
                }
            }
        });
github microsoft / mixed-reality-extension-sdk-samples / samples / acb-prototype / src / app.ts View on Github external
// Make a button for Next track
        const buttonPromiseNext = Actor.CreateFromGLTF(this.context, {
            resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
            colliderType: 'box',
            actor: {
                name: 'Altspace Cube',
                transform: {
                    local: {
                        position: { x: 0.2, y: -1, z: 0 },
                        scale: this.buttonScale
                    }
                }
            }
        });
        // Make a button for Last track
        const buttonPromiseLast = Actor.CreateFromGLTF(this.context, {
            resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
            colliderType: 'box',
            actor: {
                name: 'Altspace Cube',
                transform: {
                    local: {
                        position: { x: -0.2, y: -1, z: 0 },
                        scale: this.buttonScale
                    }
                }
            }
        });

        // Grab reference to our buttons.
        this.cubePlay = buttonPromisePlay.value;
        this.cubeNext = buttonPromiseNext.value;
github microsoft / mixed-reality-extension-sdk-samples / samples / hello-world / src / app.ts View on Github external
// The name is a unique identifier for this animation. We'll pass it to "startAnimation" later.
            "Spin", {
                // Keyframes define the timeline for the animation: where the actor should be, and when.
                // We're calling the generateSpinKeyframes function to produce a simple 20-second revolution.
                keyframes: this.generateSpinKeyframes(20, Vector3.Up()),
                // Events are points of interest during the animation. The animating actor will emit a given
                // named event at the given timestamp with a given string value as an argument.
                events: [],

                // Optionally, we also repeat the animation infinitely. PingPong alternately runs the animation
                // foward then backward.
                wrapMode: AnimationWrapMode.PingPong
            });

        // Load a glTF model
        const cubePromise = Actor.CreateFromGLTF(this.context, {
            // at the given URL
            resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
            // and spawn box colliders around the meshes.
            colliderType: 'box',
            // Also apply the following generic actor properties.
            actor: {
                name: 'Altspace Cube',
                // Parent the glTF model to the text actor.
                parentId: this.text.id,
                transform: {
                    local: {
                        position: { x: 0, y: -1, z: 0 },
                        scale: { x: 0.4, y: 0.4, z: 0.4 }
                    }
                }
            }
github microsoft / mixed-reality-extension-sdk-samples / samples / acb-prototype / src / app.ts View on Github external
// and spawn box colliders around the meshes.
            colliderType: 'box',
            // Also apply the following generic actor properties.
            actor: {
                name: 'Altspace Cube',
                // Parent the glTF model to the text actor.
                transform: {
                    local: {
                        position: { x: 0, y: -1, z: 0 },
                        scale: this.buttonScale
                    }
                }
            }
        });
        // Make a button for Next track
        const buttonPromiseNext = Actor.CreateFromGLTF(this.context, {
            resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
            colliderType: 'box',
            actor: {
                name: 'Altspace Cube',
                transform: {
                    local: {
                        position: { x: 0.2, y: -1, z: 0 },
                        scale: this.buttonScale
                    }
                }
            }
        });
        // Make a button for Last track
        const buttonPromiseLast = Actor.CreateFromGLTF(this.context, {
            resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
            colliderType: 'box',
github microsoft / mixed-reality-extension-sdk-samples / samples / tic-tac-toe / src / app.ts View on Github external
"Spin", {
                // Keyframes define the timeline for the animation: where the actor should be, and when.
                // We're calling the generateSpinKeyframes function to produce a simple 20-second revolution.
                keyframes: this.generateSpinKeyframes(20, Vector3.Up()),
                // Events are points of interest during the animation. The animating actor will emit a given
                // named event at the given timestamp with a given string value as an argument.
                events: [],

                // Optionally, we also repeat the animation infinitely.
                wrapMode: AnimationWrapMode.Loop
            });

        for (let tileIndexX = 0; tileIndexX < 3; tileIndexX++) {
            for (let tileIndexZ = 0; tileIndexZ < 3; tileIndexZ++) {
                // Load a glTF model
                const cubePromise = Actor.CreateFromGLTF(this.context, {
                    // at the given URL
                    resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
                    // and spawn box colliders around the meshes.
                    colliderType: 'box',
                    // Also apply the following generic actor properties.
                    actor: {
                        name: 'Altspace Cube',
                        transform: {
                            app: {
                                position: { x: (tileIndexX) - 1.0, y: 0.5, z: (tileIndexZ) - 1.0 },
                            },
                            local: { scale: { x: 0.4, y: 0.4, z: 0.4 } }
                        }
                    }
                });
github microsoft / mixed-reality-extension-sdk-samples / samples / acb-prototype / src / app.ts View on Github external
private started() {

        // Load a glTF model to create a Play button for the radio
        const buttonPromisePlay = Actor.CreateFromGLTF(this.context, {
            // at the given URL
            resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
            // and spawn box colliders around the meshes.
            colliderType: 'box',
            // Also apply the following generic actor properties.
            actor: {
                name: 'Altspace Cube',
                // Parent the glTF model to the text actor.
                transform: {
                    local: {
                        position: { x: 0, y: -1, z: 0 },
                        scale: this.buttonScale
                    }
                }
            }
        });

@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

48 / 100
Full package analysis