update light volume when you move light parent

This commit is contained in:
James B. Pollack 2015-12-17 11:59:21 -08:00
parent 5cc5a2ab33
commit 8e2128c692
5 changed files with 2387 additions and 789 deletions

View file

@ -1256,27 +1256,21 @@ function MyController(hand) {
var defaultReleaseVelocityData = {
disableReleaseVelocity: false
};
//sometimes we want things to stay right where they are when we let go.
var releaseVelocityData = getEntityCustomData('handControllerKey', this.grabbedEntity, defaultReleaseVelocityData);
if (releaseVelocityData.disableReleaseVelocity === true) {
print('SHOULD NOT BE KINEMATIC AT RELEASE')
// Entities.updateAction(this.grabbedEntity, this.actionID, {
// ttl: 1,
// kinematic: false,
// kinematicSetVelocity: false,
// });
Entities.deleteAction(this.grabbedEntity, this.actionID);
Entities.deleteAction(this.grabbedEntity, this.actionID);
Entities.editEntity(this.grabbedEntity,{
velocity:{
x:0,
y:0,
z:0
Entities.editEntity(this.grabbedEntity, {
velocity: {
x: 0,
y: 0,
z: 0
},
angularVelocity:{
x:0,
y:0,
z:0
angularVelocity: {
x: 0,
y: 0,
z: 0
}
})
Entities.deleteAction(this.grabbedEntity, this.actionID);
@ -1288,6 +1282,7 @@ function MyController(hand) {
}
}
}
this.deactivateEntity(this.grabbedEntity);
this.grabbedEntity = null;

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@ var lightOverlayManager;
if (SHOW_OVERLAYS === true) {
Script.include('../libraries/gridTool.js');
Script.include('../libraries/entitySelectionTool.js');
Script.include('../libraries/entitySelectionTool.js?'+Math.random(0-100));
Script.include('../libraries/lightOverlayManager.js');
var grid = Grid();

View file

@ -10,6 +10,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var PARENT_SCRIPT_URL = Script.resolvePath('lightParent.js?'+Math.random(0-100));
var basePosition, avatarRot;
avatarRot = Quat.fromPitchYawRollDegrees(0, MyAvatar.bodyYaw, 0.0);
basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(0, Quat.getUp(avatarRot)));
@ -74,6 +75,7 @@ function createBlock() {
blue: 255
},
position: position,
script:PARENT_SCRIPT_URL,
userData: JSON.stringify({
handControllerKey: {
disableReleaseVelocity: true

View file

@ -0,0 +1,42 @@
//
// slider.js
//
// Created by James Pollack @imgntn on 12/15/2015
// Copyright 2015 High Fidelity, Inc.
//
// Entity script that sends a scaled value to a light based on its distance from the start of its constraint axis.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() {
function LightParent() {
return this;
}
LightParent.prototype = {
preload: function(entityID) {
print('LIGHT PARENT SCRIPT GO')
this.entityID = entityID;
var entityProperties = Entities.getEntityProperties(this.entityID, "userData");
this.initialProperties = entityProperties
this.userData = JSON.parse(entityProperties.userData);
},
startNearGrab: function() {},
startDistantGrab: function() {
},
continueNearGrab: function() {
this.continueDistantGrab();
},
continueDistantGrab: function() {
print('distant grab, should send message!')
Messages.sendMessage('entityToolUpdates', 'callUpdate');
},
};
return new LightParent();
});