mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 23:02:24 +02:00
dressing room updates
This commit is contained in:
parent
0b867713cb
commit
d98732d5a1
3 changed files with 77 additions and 51 deletions
|
@ -78,6 +78,26 @@
|
|||
_this.locked = true;
|
||||
_this.findRotatorBlock();
|
||||
} else {
|
||||
var transformerProps = Entities.getEntityProperties(_this.entityID, ["rotation", "position"]);
|
||||
var eulerRotation = Quat.safeEulerAngles(transformerProps.rotation);
|
||||
eulerRotation.x = 0;
|
||||
eulerRotation.z = 0;
|
||||
var newRotation = Quat.fromVec3Degrees(eulerRotation);
|
||||
|
||||
//we zero out the velocity and angular velocity so the cow doesn't change position or spin
|
||||
Entities.editEntity(_this.entityID, {
|
||||
rotation: newRotation,
|
||||
velocity: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
},
|
||||
angularVelocity: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -9,48 +9,54 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js');
|
||||
var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js');
|
||||
|
||||
var AVATAR_COLLISION_HULL = 'atp:/dressingRoom/Avatar-Hull-5.obj';
|
||||
var AVATAR_COLLISION_HULL = 'atp:/dressingRoom/Avatar-Hull-6.obj';
|
||||
var ROBOT_COLLISION_HULL = 'atp:/dressingRoom/robot_hull.obj';
|
||||
TransformerDoll = function(modelURL, spawnPosition, spawnRotation, dimensions) {
|
||||
print('SCRIPT REF AT TRANSFORMER CREATE::' + TRANSFORMER_SCRIPT);
|
||||
var transformerProps = {
|
||||
name: 'hifi-home-dressing-room-little-transformer',
|
||||
type: 'Model',
|
||||
shapeType: 'compound',
|
||||
compoundShapeURL: AVATAR_COLLISION_HULL,
|
||||
position: spawnPosition,
|
||||
rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z),
|
||||
modelURL: modelURL,
|
||||
dynamic: true,
|
||||
gravity: {
|
||||
x: 0,
|
||||
y: -10,
|
||||
z: 0
|
||||
},
|
||||
visible: true,
|
||||
restitution: 0.1,
|
||||
damping: 0.9,
|
||||
angularDamping: 0.9,
|
||||
userData: JSON.stringify({
|
||||
'grabbableKey': {
|
||||
'grabbable': true
|
||||
},
|
||||
'hifiHomeTransformerKey': {
|
||||
'basePosition': spawnPosition,
|
||||
'baseRotation': Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z),
|
||||
},
|
||||
'hifiHomeKey': {
|
||||
'reset': true
|
||||
}
|
||||
}),
|
||||
density: 7500,
|
||||
dimensions: dimensions,
|
||||
script: TRANSFORMER_SCRIPT
|
||||
}
|
||||
|
||||
TransformerDoll = function(modelURL, spawnPosition, spawnRotation, dimensions) {
|
||||
print('SCRIPT REF AT TRANSFORMER CREATE::' + TRANSFORMER_SCRIPT);
|
||||
var transformerProps = {
|
||||
name: 'hifi-home-dressing-room-little-transformer',
|
||||
type: 'Model',
|
||||
shapeType: 'compound',
|
||||
compoundShapeURL: AVATAR_COLLISION_HULL,
|
||||
position: spawnPosition,
|
||||
rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z),
|
||||
modelURL: modelURL,
|
||||
dynamic: true,
|
||||
gravity: {
|
||||
x: 0,
|
||||
y: -10,
|
||||
z: 0
|
||||
},
|
||||
visible: true,
|
||||
damping: 0.8,
|
||||
angularDamping: 0.8,
|
||||
userData: JSON.stringify({
|
||||
'grabbableKey': {
|
||||
'grabbable': true
|
||||
},
|
||||
'hifiHomeTransformerKey': {
|
||||
'basePosition': spawnPosition,
|
||||
'baseRotation': Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z),
|
||||
},
|
||||
'hifiHomeKey': {
|
||||
'reset': true
|
||||
}
|
||||
}),
|
||||
density: 5000,
|
||||
dimensions: dimensions,
|
||||
script: TRANSFORMER_SCRIPT
|
||||
}
|
||||
var transformer = Entities.addEntity(transformerProps);
|
||||
if (modelURL.indexOf('robot') > -1) {
|
||||
print('THIS IS A ROBOT, GIVE IT A DIFFERENT SHAPE TYPE')
|
||||
transformerProps.compoundShapeURL =ROBOT_COLLISION_HULL;
|
||||
}
|
||||
var transformer = Entities.addEntity(transformerProps);
|
||||
|
||||
print('CREATED TRANSFORMER' + transformer);
|
||||
print('CREATED TRANSFORMER' + transformer);
|
||||
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
}
|
|
@ -418,9 +418,9 @@
|
|||
|
||||
createTransformers: function() {
|
||||
var firstDollPosition = {
|
||||
x: 1107.61,
|
||||
y: 460.6,
|
||||
z: -77.34
|
||||
x: 1107.6,
|
||||
y: 460.575,
|
||||
z: -77.37
|
||||
}
|
||||
|
||||
var dollRotation = {
|
||||
|
@ -432,20 +432,15 @@
|
|||
var rotationAsQuat = Quat.fromPitchYawRollDegrees(dollRotation.x, dollRotation.y, dollRotation.z);
|
||||
|
||||
var dolls = [
|
||||
TRANSFORMER_URL_STYLIZED_FEMALE,
|
||||
TRANSFORMER_URL_ROBOT,
|
||||
TRANSFORMER_URL_BEING_OF_LIGHT,
|
||||
TRANSFORMER_URL_STYLIZED_FEMALE,
|
||||
TRANSFORMER_URL_WILL,
|
||||
TRANSFORMER_URL_PRISCILLA,
|
||||
TRANSFORMER_URL_MATTHEW
|
||||
];
|
||||
|
||||
var dollDimensions = [{
|
||||
//stylized female artemis
|
||||
x: 1.6323,
|
||||
y: 1.7705,
|
||||
z: 0.2851
|
||||
}, {
|
||||
//robot
|
||||
x: 1.4439,
|
||||
y: 0.6224,
|
||||
|
@ -455,6 +450,11 @@
|
|||
x: 1.8838,
|
||||
y: 1.7865,
|
||||
z: 0.2955
|
||||
}, {
|
||||
//stylized female artemis
|
||||
x: 1.6323,
|
||||
y: 1.7705,
|
||||
z: 0.2851
|
||||
}, {
|
||||
//will
|
||||
x: 1.6326,
|
||||
|
@ -486,7 +486,7 @@
|
|||
var left = Quat.getRight(rotationAsQuat);
|
||||
var distanceToLeft = Vec3.multiply(separation, left);
|
||||
var dollPosition = Vec3.sum(firstDollPosition, distanceToLeft);
|
||||
if (index === 1) {
|
||||
if (index === 0) {
|
||||
//special case for robot
|
||||
dollPosition.y += 0.15;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue