mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 20:36:24 +02:00
fix for two space indentation in createBatButton.js
This commit is contained in:
parent
c3f3639374
commit
1b1efe53d9
1 changed files with 45 additions and 45 deletions
|
@ -20,58 +20,58 @@
|
||||||
this.dropBats();
|
this.dropBats();
|
||||||
};
|
};
|
||||||
this.startFarTrigger = function() {
|
this.startFarTrigger = function() {
|
||||||
this.dropBats();
|
this.dropBats();
|
||||||
};
|
};
|
||||||
this.dropBats = function() {
|
this.dropBats = function() {
|
||||||
// if the bat box is near us, grab it's position
|
// if the bat box is near us, grab it's position
|
||||||
var nearby = Entities.findEntities(this.position, 20);
|
var nearby = Entities.findEntities(this.position, 20);
|
||||||
|
|
||||||
nearby.forEach(function(id) {
|
nearby.forEach(function(id) {
|
||||||
var properties = Entities.getEntityProperties(id, ["name", "position"]);
|
var properties = Entities.getEntityProperties(id, ["name", "position"]);
|
||||||
if (properties.name && properties.name == "Bat Box") {
|
if (properties.name && properties.name == "Bat Box") {
|
||||||
boxPosition = properties.position;
|
boxPosition = properties.position;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var BAT_DROP_HEIGHT = 2.0;
|
var BAT_DROP_HEIGHT = 2.0;
|
||||||
|
|
||||||
var dropPosition;
|
var dropPosition;
|
||||||
|
|
||||||
if (!boxPosition) {
|
if (!boxPosition) {
|
||||||
// we got no bat box position, drop in front of the avatar instead
|
// we got no bat box position, drop in front of the avatar instead
|
||||||
} else {
|
} else {
|
||||||
// drop the bat above the bat box
|
// drop the bat above the bat box
|
||||||
dropPosition = Vec3.sum(boxPosition, { x: 0.0, y: BAT_DROP_HEIGHT, z: 0.0});
|
dropPosition = Vec3.sum(boxPosition, { x: 0.0, y: BAT_DROP_HEIGHT, z: 0.0});
|
||||||
}
|
|
||||||
|
|
||||||
var BAT_MODEL = "atp:c47deaae09cca927f6bc9cca0e8bbe77fc618f8c3f2b49899406a63a59f885cb.fbx";
|
|
||||||
var BAT_COLLISION_HULL = "atp:9eafceb7510c41d50661130090de7e0632aa4da236ebda84a0059a4be2130e0c.obj";
|
|
||||||
var SCRIPT_URL = "http://rawgit.com/birarda/hifi/baseball/examples/baseball/bat.js"
|
|
||||||
|
|
||||||
var batUserData = {
|
|
||||||
grabbableKey: {
|
|
||||||
spatialKey: {
|
|
||||||
relativePosition: { x: 0.9, y: 0, z: 0 },
|
|
||||||
relativeRotation: Quat.fromPitchYawRollDegrees(0, 0, 45),
|
|
||||||
perHandRelativePosition: { x: 0.0, y: -0.05, z: -0.04 },
|
|
||||||
perHandRelativeRotation: Quat.fromPitchYawRollDegrees(0, 0, 0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// add the fresh bat at the drop position
|
var BAT_MODEL = "atp:c47deaae09cca927f6bc9cca0e8bbe77fc618f8c3f2b49899406a63a59f885cb.fbx";
|
||||||
var bat = Entities.addEntity({
|
var BAT_COLLISION_HULL = "atp:9eafceb7510c41d50661130090de7e0632aa4da236ebda84a0059a4be2130e0c.obj";
|
||||||
name: 'Bat',
|
var SCRIPT_URL = "http://rawgit.com/birarda/hifi/baseball/examples/baseball/bat.js"
|
||||||
type: "Model",
|
|
||||||
modelURL: BAT_MODEL,
|
var batUserData = {
|
||||||
position: dropPosition,
|
grabbableKey: {
|
||||||
compoundShapeURL: BAT_COLLISION_HULL,
|
spatialKey: {
|
||||||
collisionsWillMove: true,
|
relativePosition: { x: 0.9, y: 0, z: 0 },
|
||||||
velocity: { x: 0, y: 0.05, z: 0}, // workaround for gravity not taking effect on add
|
relativeRotation: Quat.fromPitchYawRollDegrees(0, 0, 45),
|
||||||
gravity: { x: 0, y: -9.81, z: 0},
|
perHandRelativePosition: { x: 0.0, y: -0.05, z: -0.04 },
|
||||||
rotation: Quat.fromPitchYawRollDegrees(0.0, 0.0, -90.0),
|
perHandRelativeRotation: Quat.fromPitchYawRollDegrees(0, 0, 0)
|
||||||
script: SCRIPT_URL,
|
}
|
||||||
userData: JSON.stringify(batUserData)
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
// add the fresh bat at the drop position
|
||||||
|
var bat = Entities.addEntity({
|
||||||
|
name: 'Bat',
|
||||||
|
type: "Model",
|
||||||
|
modelURL: BAT_MODEL,
|
||||||
|
position: dropPosition,
|
||||||
|
compoundShapeURL: BAT_COLLISION_HULL,
|
||||||
|
collisionsWillMove: true,
|
||||||
|
velocity: { x: 0, y: 0.05, z: 0}, // workaround for gravity not taking effect on add
|
||||||
|
gravity: { x: 0, y: -9.81, z: 0},
|
||||||
|
rotation: Quat.fromPitchYawRollDegrees(0.0, 0.0, -90.0),
|
||||||
|
script: SCRIPT_URL,
|
||||||
|
userData: JSON.stringify(batUserData)
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue