overte/script-archive/tutorials/fireworks/chapter2/fireworksLaunchButtonSpawner.js

38 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2016-03-07 14:09:21 -08:00
//
// fireworksLaunchButtonSpawner.js
//
2016-03-07 14:29:17 -08:00
// Created by Eric Levin on 3/7/2016
2016-03-07 14:09:21 -08:00
// Copyright 2016 High Fidelity, Inc.
//
2022-08-19 23:20:12 +02:00
// This is the chapter 2 interface script of the fireworks tutorial
2016-03-07 14:09:21 -08:00
//
// Distributed under the Apache License, Version 2.0.
2016-03-01 12:43:06 -08:00
var orientation = Camera.getOrientation();
orientation = Quat.safeEulerAngles(orientation);
orientation.x = 0;
orientation = Quat.fromVec3Degrees(orientation);
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(orientation)));
var SCRIPT_URL = Script.resolvePath("fireworksLaunchButtonEntityScript.js");
var MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/Launch-Button.fbx";
var launchButton = Entities.addEntity({
type: "Model",
name: "hifi-launch-button",
modelURL: MODEL_URL,
position: center,
dimensions: {
x: 0.98,
y: 1.16,
z: 0.98
},
script: SCRIPT_URL,
})
function cleanup() {
Entities.deleteEntity(launchButton);
}
2022-08-03 21:16:14 +02:00
Script.scriptEnding.connect(cleanup);