border, new size for blocks, smoother hydra grab action

This commit is contained in:
Philip Rosedale 2015-01-26 22:06:59 -08:00
parent 8b5a451886
commit e8f4783bea
2 changed files with 16 additions and 21 deletions

View file

@ -9,11 +9,14 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var FLOOR_SIZE = 5.0;
var FLOOR_SIZE = 7.5;
var FLOOR_THICKNESS = 0.10;
var EDGE_THICKESS = 0.25;
var SCALE = 0.25;
var NUM_BLOCKS = 25;
var DROP_HEIGHT = SCALE * 8.0;
var GRAVITY = -1.0;
var LIFETIME = 6000;
var DAMPING = 0.50;
@ -23,7 +26,7 @@ blockTypes.push({ x: 1, y: 1, z: 1, red: 255, green: 0, blue: 0 });
blockTypes.push({ x: 1, y: 1, z: 2, red: 0, green: 255, blue: 0 });
blockTypes.push({ x: 1, y: 2, z: 5, red: 0, green: 0, blue: 255 });
blockTypes.push({ x: 1, y: 2, z: 2, red: 255, green: 255, blue: 0 });
blockTypes.push({ x: 1, y: 1, z: 5, red: 0, green: 255, blue: 255 });
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(FLOOR_SIZE * 2.0, Quat.getFront(Camera.getOrientation())));
@ -45,6 +48,7 @@ var edge1 = Entities.addEntity(
gravity: { x: 0, y: 0, z: 0 },
ignoreCollisions: false,
visible: true,
locked: true,
lifetime: LIFETIME });
var edge2 = Entities.addEntity(
@ -55,6 +59,7 @@ var edge2 = Entities.addEntity(
gravity: { x: 0, y: 0, z: 0 },
ignoreCollisions: false,
visible: true,
locked: true,
lifetime: LIFETIME });
var edge3 = Entities.addEntity(
@ -65,6 +70,7 @@ var edge3 = Entities.addEntity(
gravity: { x: 0, y: 0, z: 0 },
ignoreCollisions: false,
visible: true,
locked: true,
lifetime: LIFETIME });
var edge4 = Entities.addEntity(
@ -75,11 +81,9 @@ var edge4 = Entities.addEntity(
gravity: { x: 0, y: 0, z: 0 },
ignoreCollisions: false,
visible: true,
locked: true,
lifetime: LIFETIME });
var NUM_BLOCKS = 20;
var DROP_HEIGHT = FLOOR_SIZE / 3;
blocks = [];
for (var i = 0; i < NUM_BLOCKS; i++) {

View file

@ -363,25 +363,16 @@ function controller(wichSide) {
}
var newPosition;
var newRotation;
var forward = Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -1 });
var d = Vec3.dot(forward, MyAvatar.position);
var factor1 = Vec3.dot(forward, this.positionAtGrab) - d;
var factor2 = Vec3.dot(forward, this.modelPositionAtGrab) - d;
var vector = Vec3.subtract(this.palmPosition, this.positionAtGrab);
if (factor2 < 0) {
factor2 = 0;
}
if (factor1 <= 0) {
factor1 = 1;
factor2 = 1;
var CONSTANT_SCALING_FACTOR = 5.0;
var MINIMUM_SCALING_DISTANCE = 2.0;
var distanceToModel = Vec3.length(Vec3.subtract(this.oldModelPosition, this.palmPosition));
if (distanceToModel < MINIMUM_SCALING_DISTANCE) {
distanceToModel = MINIMUM_SCALING_DISTANCE;
}
newPosition = Vec3.sum(this.modelPositionAtGrab,
Vec3.multiply(vector,
factor2 / factor1));
var deltaPalm = Vec3.multiply(distanceToModel * CONSTANT_SCALING_FACTOR, Vec3.subtract(this.palmPosition, this.oldPalmPosition));
newPosition = Vec3.sum(this.oldModelPosition, deltaPalm);
newRotation = Quat.multiply(this.rotation,
Quat.inverse(this.rotationAtGrab));