mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:27:04 +02:00
works with new version from catlyn.
This commit is contained in:
parent
55fe2f9dc0
commit
8daf9698bd
5 changed files with 6 additions and 39 deletions
|
@ -3,22 +3,10 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var pivotID, needleID;
|
var thisEntityID;
|
||||||
|
|
||||||
this.preload = function (entityID) {
|
this.preload = function (entityID) {
|
||||||
|
thisEntityID = entityID;
|
||||||
var children = Entities.getChildrenIDs(entityID);
|
|
||||||
var childZero = Entities.getEntityProperties(children[0]);
|
|
||||||
var childOne = Entities.getEntityProperties(children[1]);
|
|
||||||
var childZeroUserData = JSON.parse(Entities.getEntityProperties(children[0]).userData);
|
|
||||||
|
|
||||||
if (childZeroUserData.name === "pivot") {
|
|
||||||
pivotID = childZero.id;
|
|
||||||
needleID = childOne.id;
|
|
||||||
} else {
|
|
||||||
pivotID = childOne.id;
|
|
||||||
needleID = childZero.id;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var SCAN_RATE = 100; //ms
|
var SCAN_RATE = 100; //ms
|
||||||
|
@ -70,10 +58,8 @@
|
||||||
// we have a range of 55 to -53 degrees for the needle
|
// we have a range of 55 to -53 degrees for the needle
|
||||||
|
|
||||||
var scaledDegrees = (norm / -.94) + 54.5; // shifting scale from 100 to 55 to -53 ish its more like -51 ;
|
var scaledDegrees = (norm / -.94) + 54.5; // shifting scale from 100 to 55 to -53 ish its more like -51 ;
|
||||||
Entities.editEntity(pivotID, {
|
|
||||||
localRotation: Quat.fromPitchYawRollDegrees(0, 0, scaledDegrees)
|
|
||||||
});
|
|
||||||
|
|
||||||
|
Entities.setAbsoluteJointRotationInObjectFrame(thisEntityID, 0, Quat.fromPitchYawRollDegrees(0, 0, scaledDegrees));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -10,34 +10,15 @@
|
||||||
var meter = {
|
var meter = {
|
||||||
stand: {
|
stand: {
|
||||||
type: 'Model',
|
type: 'Model',
|
||||||
modelURL: 'https://binaryrelay.com/files/public-docs/hifi/meter/applauseOmeterTextured.fbx',
|
modelURL: 'https://binaryrelay.com/files/public-docs/hifi/meter/applauseOmeter.fbx',
|
||||||
lifetime: '3600',
|
lifetime: '3600',
|
||||||
script: 'https://binaryrelay.com/files/public-docs/hifi/meter/applauseOmeter.js',
|
script: 'https://binaryrelay.com/files/public-docs/hifi/meter/applauseOmeter.js',
|
||||||
position: Vec3.sum(pos, {x: 0, y: 2.0, z: 0})
|
position: Vec3.sum(pos, {x: 0, y: 2.0, z: 0})
|
||||||
},
|
|
||||||
pivot:{
|
|
||||||
type:'Sphere',
|
|
||||||
parentID: '',
|
|
||||||
userData: '{"name":"pivot"}',
|
|
||||||
dimensions: {x: .05, y: .05, z: .05},
|
|
||||||
lifetime: '3600',
|
|
||||||
position: Vec3.sum(pos, {x: 0, y: 3.385, z: 0.2})
|
|
||||||
},
|
|
||||||
needle: {
|
|
||||||
type: 'Model',
|
|
||||||
modelURL:'https://binaryrelay.com/files/public-docs/hifi/meter/applauseOmeterNeedleTextured.fbx',
|
|
||||||
parentID: '',
|
|
||||||
userData: '{"name":"needle"}',
|
|
||||||
dimensions: {x: .286, y: 1.12, z: .07},
|
|
||||||
lifetime: '3600',
|
|
||||||
position: Vec3.sum(pos, {x: 0, y: 3.85, z: 0.2})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
meter.pivot.parentID = Entities.addEntity(meter.stand);
|
Entities.addEntity(meter.stand);
|
||||||
meter.needle.parentID = Entities.addEntity(meter.pivot);
|
|
||||||
Entities.addEntity(meter.needle);
|
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue