mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 20:58:38 +02:00
watering can atp
This commit is contained in:
parent
864fa4b760
commit
1f3d1ac1b9
6 changed files with 72 additions and 36 deletions
|
@ -1,7 +1,7 @@
|
||||||
var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js?' + Math.random());
|
var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js?' + Math.random());
|
||||||
|
|
||||||
var AVATAR_COLLISION_HULL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/dressingRoom/Avatar-Hull-4.obj';
|
var AVATAR_COLLISION_HULL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/dressingRoom/Avatar-Hull-4.obj';
|
||||||
// var SHRINK_AMOUNT = 1 / 2;
|
|
||||||
TransformerDoll = function(modelURL, spawnPosition, spawnRotation, dimensions) {
|
TransformerDoll = function(modelURL, spawnPosition, spawnRotation, dimensions) {
|
||||||
print('SCRIPT REF AT TRANSFORMER CREATE::' + TRANSFORMER_SCRIPT);
|
print('SCRIPT REF AT TRANSFORMER CREATE::' + TRANSFORMER_SCRIPT);
|
||||||
var transformerProps = {
|
var transformerProps = {
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
var PLANT_SCRIPT_URL = Script.resolvePath("atp:/scripts/growingPlantEntityScript.js?v1" + Math.random());
|
var PLANT_SCRIPT_URL = Script.resolvePath("atp:/scripts/growingPlantEntityScript.js" + Math.random());
|
||||||
var WATER_CAN_SCRIPT_URL = Script.resolvePath("atp:/scripts/waterCanEntityScript.js?v1" + Math.random());
|
var WATER_CAN_SCRIPT_URL = Script.resolvePath("atp:/scripts/waterCanEntityScript.js");
|
||||||
Plant = function(spawnPosition, spawnRotation) {
|
Plant = function(spawnPosition, spawnRotation) {
|
||||||
var orientation;
|
var orientation;
|
||||||
if (spawnRotation !== undefined) {
|
if (spawnRotation !== undefined) {
|
||||||
|
|
|
@ -11,7 +11,14 @@
|
||||||
var SHUT_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/Sounds/book_fall.L.wav';
|
var SHUT_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/Sounds/book_fall.L.wav';
|
||||||
var OPEN_SOUND_URL = 'http://public.highfidelity.io/sounds/Switches%20and%20sliders/lamp_switch_2.wav'
|
var OPEN_SOUND_URL = 'http://public.highfidelity.io/sounds/Switches%20and%20sliders/lamp_switch_2.wav'
|
||||||
|
|
||||||
|
var GO_UP_ANIMATION = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/musicBox/MusicBox_ComesUp.fbx';
|
||||||
|
var GO_DOWN_ANIMATION = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/musicBox/MusicBox_GoesDown.fbx';
|
||||||
|
var HOLD_ANIMATION = '';
|
||||||
|
var KEY_TURNING_ANIMATION = '';
|
||||||
|
var FULLY_CLOSED_ANIMATION = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/musicBox/MusicBoxNoLidNoanimation.fbx';
|
||||||
|
|
||||||
Lid.prototype = {
|
Lid.prototype = {
|
||||||
|
musicInjector: null,
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
print('PRELOAD LID')
|
print('PRELOAD LID')
|
||||||
_this.entityID = entityID;
|
_this.entityID = entityID;
|
||||||
|
@ -129,7 +136,9 @@
|
||||||
stopKeyTurnAnimation: function() {},
|
stopKeyTurnAnimation: function() {},
|
||||||
|
|
||||||
unload: function() {
|
unload: function() {
|
||||||
this.musicInjector.stop();
|
if (this.musicInjector !== null) {
|
||||||
|
this.musicInjector.stop();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
var musicBoxPath = Script.resolvePath('wrapper.js?' + Math.random());
|
||||||
|
Script.include(musicBoxPath);
|
||||||
|
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||||
|
x: 0,
|
||||||
|
y: 0.5,
|
||||||
|
z: 0
|
||||||
|
}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
||||||
|
var musicBox = new HomeMusicBox(center, {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(function() {
|
||||||
|
musicBox.cleanup()
|
||||||
|
})
|
|
@ -1,4 +1,4 @@
|
||||||
var HomeMusicBox = function() {
|
HomeMusicBox = function(spawnPosition, spawnRotation) {
|
||||||
|
|
||||||
var SHOULD_CLEANUP = false;
|
var SHOULD_CLEANUP = false;
|
||||||
|
|
||||||
|
@ -33,41 +33,45 @@ var HomeMusicBox = function() {
|
||||||
}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
||||||
|
|
||||||
var BASE_DIMENSIONS = {
|
var BASE_DIMENSIONS = {
|
||||||
x: 0.5,
|
x: 0.1661,
|
||||||
y: 0.5,
|
y: 0.1010,
|
||||||
z: 0.5
|
z: 0.2256
|
||||||
};
|
};
|
||||||
|
|
||||||
var BASE_POSITION = center;
|
var BASE_POSITION = center;
|
||||||
|
|
||||||
var LID_DIMENSIONS = {
|
var LID_DIMENSIONS = {
|
||||||
x: BASE_DIMENSIONS.x,
|
x: 0.1435,
|
||||||
y: BASE_DIMENSIONS.y / 8,
|
y: 0.0246,
|
||||||
z: BASE_DIMENSIONS.z
|
z: 0.1772
|
||||||
};
|
};
|
||||||
|
|
||||||
var LID_OFFSET = {
|
var LID_OFFSET = {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: BASE_DIMENSIONS.y / 2 + (LID_DIMENSIONS.y / 2),
|
y: BASE_DIMENSIONS.y / 2,
|
||||||
z: 0.25
|
// y: BASE_DIMENSIONS.y / 2 + (LID_DIMENSIONS.y / 2),
|
||||||
|
z: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
var LID_REGISTRATION_POINT = {
|
var LID_REGISTRATION_POINT = {
|
||||||
x: 0.5,
|
x: 0,
|
||||||
y: 0.5,
|
y: 0.5,
|
||||||
z: 1
|
z: 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
var LID_SCRIPT_URL = Script.resolvePath('lid.js?' + Math.random());
|
var LID_SCRIPT_URL = Script.resolvePath('lid.js?' + Math.random());
|
||||||
|
|
||||||
var base, lid;
|
var LID_MODEL_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/musicBox/MusicBoxLid.fbx';
|
||||||
|
var BASE_MODEL_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/musicBox/MusicBoxNoLidNoanimation.fbx';
|
||||||
|
|
||||||
|
|
||||||
|
var base, lid;
|
||||||
|
|
||||||
function createBase() {
|
function createBase() {
|
||||||
var baseProperties = {
|
var baseProperties = {
|
||||||
name: 'hifi-home-music-box-base',
|
name: 'hifi-home-music-box-base',
|
||||||
type: 'Box',
|
type: 'Model',
|
||||||
color: WHITE,
|
modelURL: BASE_MODEL_URL,
|
||||||
position: BASE_POSITION,
|
position: BASE_POSITION,
|
||||||
dimensions: BASE_DIMENSIONS,
|
dimensions: BASE_DIMENSIONS,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
|
@ -78,26 +82,36 @@ var HomeMusicBox = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
base = Entities.addEntity(baseProperties);
|
base = Entities.addEntity(baseProperties);
|
||||||
|
createLid(base);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function createLid() {
|
function createLid(baseID) {
|
||||||
|
|
||||||
var lidPosition = Vec3.sum(BASE_POSITION, LID_OFFSET);
|
var baseProps = Entities.getEntityProperties(baseID);
|
||||||
print('LID DIMENSIONS:' + JSON.stringify(lidPosition))
|
var frontVector = Quat.getFront(baseProps.rotation);
|
||||||
|
var rightVector = Quat.getRight(baseProps.rotation);
|
||||||
|
var backVector = Vec3.multiply(-1, frontVector);
|
||||||
|
var backOffset = 0.0125;
|
||||||
|
var backPosition = baseProps.position;
|
||||||
|
var backPosition = Vec3.sum(baseProps.position, Vec3.multiply(backOffset, backVector));
|
||||||
|
backPosition.y = backPosition.y +=(BASE_DIMENSIONS.y / 2)
|
||||||
|
// backPosition = Vec3.sum(backPosition,LID_OFFSET)
|
||||||
|
print('backPosition' + JSON.stringify(backPosition));
|
||||||
var lidProperties = {
|
var lidProperties = {
|
||||||
name: 'hifi-home-music-box-lid',
|
name: 'hifi-home-music-box-lid',
|
||||||
type: 'Box',
|
type: 'Model',
|
||||||
color: BLUE,
|
modelURL: LID_MODEL_URL,
|
||||||
dimensions: LID_DIMENSIONS,
|
dimensions: LID_DIMENSIONS,
|
||||||
position: lidPosition,
|
position: backPosition,
|
||||||
registrationPoint: LID_REGISTRATION_POINT,
|
registrationPoint: LID_REGISTRATION_POINT,
|
||||||
dynamic: false,
|
dynamic: false,
|
||||||
script: LID_SCRIPT_URL,
|
script: LID_SCRIPT_URL,
|
||||||
collidesWith: 'myAvatar,otherAvatar',
|
collidesWith: 'myAvatar,otherAvatar',
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
'hifiHomeKey': {
|
'hifiHomeKey': {
|
||||||
'reset': true
|
'reset': true,
|
||||||
|
'musicBoxBase': baseID
|
||||||
},
|
},
|
||||||
grabConstraintsKey: {
|
grabConstraintsKey: {
|
||||||
callback: 'rotateLid',
|
callback: 'rotateLid',
|
||||||
|
@ -105,23 +119,20 @@ var HomeMusicBox = function() {
|
||||||
rotationLocked: false,
|
rotationLocked: false,
|
||||||
positionMod: false,
|
positionMod: false,
|
||||||
rotationMod: {
|
rotationMod: {
|
||||||
pitch: {
|
roll: {
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 75,
|
max: 75,
|
||||||
startingAxis: 'y',
|
startingAxis: 'y',
|
||||||
startingPoint: lidPosition.y,
|
startingPoint: backPosition.y,
|
||||||
distanceToMax: lidPosition.y + 0.35,
|
distanceToMax: backPosition.y + 0.35,
|
||||||
},
|
},
|
||||||
yaw: false,
|
yaw: false,
|
||||||
roll: false
|
pitch: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
wantsTrigger: true,
|
wantsTrigger: true,
|
||||||
disableReleaseVelocity: true,
|
disableReleaseVelocity: true
|
||||||
disableMoveWithHead: true,
|
|
||||||
disableFarGrab: true,
|
|
||||||
disableEquip: true
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -151,7 +162,7 @@ var HomeMusicBox = function() {
|
||||||
this.cleanup = cleanup;
|
this.cleanup = cleanup;
|
||||||
|
|
||||||
createBase();
|
createBase();
|
||||||
createLid();
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
var whiteboardPath = Script.resolvePath("whiteboard/wrapper.js?" + Math.random());
|
var whiteboardPath = Script.resolvePath("whiteboard/wrapper.js?" + Math.random());
|
||||||
|
|
||||||
var plantPath = Script.resolvePath("growingPlant/wrapper.js?" + Math.random());
|
var plantPath = Script.resolvePath("growingPlant/wrapper.js");
|
||||||
|
|
||||||
var cuckooClockPath = Script.resolvePath("cuckooClock/wrapper.js?" + Math.random());
|
var cuckooClockPath = Script.resolvePath("cuckooClock/wrapper.js?" + Math.random());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue