mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 07:50:04 +02:00
basic marker entity script
This commit is contained in:
parent
df84a166e4
commit
7f23ee04be
2 changed files with 37 additions and 10 deletions
35
examples/homeContent/whiteboardV2/markerEntityScript.js
Normal file
35
examples/homeContent/whiteboardV2/markerEntityScript.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// markerTipEntityScript.js
|
||||||
|
// examples/homeContent/markerTipEntityScript
|
||||||
|
//
|
||||||
|
// Created by Eric Levin on 2/17/15.
|
||||||
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
Script.include("../../libraries/utils.js");
|
||||||
|
|
||||||
|
MarkerTip = function() {
|
||||||
|
_this = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
MarkerTip.prototype = {
|
||||||
|
|
||||||
|
continueNearGrab: function() {
|
||||||
|
print("EBL Conintue ")
|
||||||
|
},
|
||||||
|
|
||||||
|
preload: function(entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// entity scripts always need to return a newly constructed object of our type
|
||||||
|
return new MarkerTip();
|
||||||
|
});
|
|
@ -41,6 +41,7 @@ var whiteboard = Entities.addEntity({
|
||||||
|
|
||||||
var markerPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1.9, Quat.getFront(orientation)));
|
var markerPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1.9, Quat.getFront(orientation)));
|
||||||
var MARKER_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/marker-blue.fbx";
|
var MARKER_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/marker-blue.fbx";
|
||||||
|
var MARKER_SCRIPT_URL = Script.resolvePath("markerEntityScript.js?v1" + Math.random());
|
||||||
var marker = Entities.addEntity({
|
var marker = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: MARKER_MODEL_URL,
|
modelURL: MARKER_MODEL_URL,
|
||||||
|
@ -51,7 +52,6 @@ var marker = Entities.addEntity({
|
||||||
y: -1,
|
y: -1,
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
// rotation: whiteboardRotation,
|
|
||||||
velocity: {
|
velocity: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -0.1,
|
y: -0.1,
|
||||||
|
@ -63,6 +63,7 @@ var marker = Entities.addEntity({
|
||||||
y: 0.0272,
|
y: 0.0272,
|
||||||
z: 0.1641
|
z: 0.1641
|
||||||
},
|
},
|
||||||
|
script: MARKER_SCRIPT_URL,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
wearable: {
|
wearable: {
|
||||||
joints: {
|
joints: {
|
||||||
|
@ -91,20 +92,11 @@ var marker = Entities.addEntity({
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
var markerTip = Entities.addEntity({
|
|
||||||
type: "Box",
|
|
||||||
dimensions: {x: 0.05, y: 0.05, z: 0.05},
|
|
||||||
position: Vec3.sum(markerPosition, {x: 0.0, y: 0.001, z: 0.1}),
|
|
||||||
parentID: marker,
|
|
||||||
color: {red: 200, green: 10, blue: 200},
|
|
||||||
collisionless: true
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
Entities.deleteEntity(whiteboard);
|
Entities.deleteEntity(whiteboard);
|
||||||
Entities.deleteEntity(marker);
|
Entities.deleteEntity(marker);
|
||||||
Entities.deleteEntity(markerTip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.scriptEnding.connect(cleanup);
|
Script.scriptEnding.connect(cleanup);
|
Loading…
Reference in a new issue