153 lines
5.9 KiB
JavaScript
Raw Permalink Normal View History

// parentator.js
//
// Script Type: Entity
// Created by Jeff Moyes on 6/30/2017
// Copyright 2017 High Fidelity, Inc.
//
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
// This script allows users to parent one object to another via the "parent-ator" entity
// (which looks like a purple gun-like object). The user:
// 1) equips their avatar with this parent-ator,
// 2) taps the end of the parent-ator on an entity (which becomes the child entity), and
// 3) taps the end of the parent-ator on a second entity (which becomes the parent entity)
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() {
var MESSAGE_0_TEXTURE_URL = Script.resolvePath( 'resources/message-0-off.png' );
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
var MESSAGE_1_TEXTURE_URL = Script.resolvePath( 'resources/message-1-start.png' );
var MESSAGE_2_TEXTURE_URL = Script.resolvePath( 'resources/message-2-noperms.png' );
var MESSAGE_3_TEXTURE_URL = Script.resolvePath( 'resources/message-3-tryagain.png' );
var MESSAGE_4_TEXTURE_URL = Script.resolvePath( 'resources/message-4-setparent.png' );
var MESSAGE_5_TEXTURE_URL = Script.resolvePath( 'resources/message-5-success.png' );
var SOUND_1_URL = Script.resolvePath( 'resources/parent-tool-sound1.wav' );
var SOUND_2_URL = Script.resolvePath( 'resources/parent-tool-sound2.wav' );
var SOUND_ERROR_URL = Script.resolvePath( 'resources/parent-tool-sound-error.wav' );
var SOUND_SUCCESS_URL = Script.resolvePath( 'resources/parent-tool-sound-success.wav' );
var SOUND_1, SOUND_2, SOUND_ERROR, SOUND_SUCCESS;
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
var childEntityID, parentEntityID;
var active = false;
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
function Parentator() {
return;
}
Parentator.prototype.turnOff = function() {
childEntityID = 0;
parentEntityID = 0;
this.active = false;
Entities.editEntity( this.entityID, { textures: JSON.stringify({ "texture-message": MESSAGE_0_TEXTURE_URL }) });
}
Parentator.prototype.turnOn = function() {
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
childEntityID = 0;
parentEntityID = 0;
this.active = true;
if (Entities.canRez()) {
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
Entities.editEntity( this.entityID, { textures: JSON.stringify({ "texture-message": MESSAGE_1_TEXTURE_URL }) });
this.playSoundAtCurrentPosition( SOUND_1 );
} else {
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
Entities.editEntity( this.entityID, { textures: JSON.stringify({ "texture-message": MESSAGE_2_TEXTURE_URL }) });
this.playSoundAtCurrentPosition( SOUND_ERROR );
}
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
}
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
Parentator.prototype.preload = function( entityID ) {
this.entityID = entityID;
SOUND_1 = SoundCache.getSound( SOUND_1_URL );
SOUND_2 = SoundCache.getSound( SOUND_2_URL );
SOUND_ERROR = SoundCache.getSound( SOUND_ERROR_URL );
SOUND_SUCCESS = SoundCache.getSound( SOUND_SUCCESS_URL );
// Makue sure it's off
this.turnOff();
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
}
Parentator.prototype.startEquip = function( args ) {
this.hand = args[0];
this.turnOn();
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
}
Parentator.prototype.releaseEquip = function( args ) {
this.hand = undefined;
this.turnOff();
}
Parentator.prototype.collisionWithEntity = function( parentatorID, collidedID, collisionInfo ) {
if ( this.active ) {
// We don't want to be able to select Lights, Zone, and Particles but they are not collidable anyway so we don't have to worry about them
var collidedEntityProperties = Entities.getEntityProperties( collidedID );
if ( !Entities.canRez() ) {
Entities.editEntity( this.entityID, { textures: JSON.stringify({ "texture-message": MESSAGE_2_TEXTURE_URL }) });
this.playSoundAtCurrentPosition( SOUND_ERROR );
}
// User has just reclicked the first entity (or it's 'bounced')
if ( childEntityID == collidedID ) {
return;
}
if ( collidedEntityProperties.locked ) {
Entities.editEntity( this.entityID, { textures: JSON.stringify({ "texture-message": MESSAGE_3_TEXTURE_URL }) });
this.playSoundAtCurrentPosition( SOUND_ERROR );
return;
}
// If no entity has been chosen
if ( childEntityID == 0 ) {
childEntityID = collidedID;
// if there is a parentID, remove it
if ( collidedEntityProperties.parentID != "{00000000-0000-0000-0000-000000000000}" ) {
Entities.editEntity( collidedID, { parentID: "{00000000-0000-0000-0000-000000000000}" });
}
if ( collidedEntityProperties.dynamic ) {
Entities.editEntity( collidedID, { dynamic: false });
}
Entities.editEntity( this.entityID, { textures: JSON.stringify({ "texture-message": MESSAGE_4_TEXTURE_URL }) });
this.playSoundAtCurrentPosition( SOUND_2 );
} else {
parentEntityID = collidedID;
this.setParent();
}
}
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
}
Parentator.prototype.setParent = function() {
var _this = this;
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
Entities.editEntity( childEntityID, { parentID: parentEntityID });
Entities.editEntity( this.entityID, { textures: JSON.stringify({ "texture-message": MESSAGE_5_TEXTURE_URL }) });
this.playSoundAtCurrentPosition( SOUND_SUCCESS );
Script.setTimeout( function() {
_this.turnOn(); // reset
}, 5000 );
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
}
Parentator.prototype.playSoundAtCurrentPosition = function( sound ) {
var audioProperties = {
volume: 0.3,
position: Entities.getEntityProperties( this.entityID ).position,
localOnly: true
}
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
Audio.playSound( sound, audioProperties );
}
Parentator.prototype.unload = function () {
Fixes for issues found with last Pull Request 1) Does not give the message regarding not having permissions except for when first rezing the tool. ▶ Fixed - Added in a check for every time there is a collision between the parent-ator and another entity 2) Sound almost unhearable due to distortion ▶ Fixed - Changed audio to 16 bit mono 3) The Parent-ator model rezzes pointing at the user's face. Would probably be better to add 180 to START_POSITION.y then normalize. ▶ Fixed - Added 180 to START_ROTATION (instead fo START_POSITION) and normalized 4) The Parent-ator model floats away. Would suggest increasing linear damping from the default. Maybe go to 0.9 or more. ▶ Fixed - Added damping of 0.9 5) The face normals are inverted on the three rings surrounding the barrel of the Parent-ator model. ▶ Fixed - Normals flipped 6) Also if the user taps an object then releases and re-equips with the Parent-ator it continues to display "tap the child" but will set the object tapped first as the child of the first other object tapped after re-equipping. So the messages change from Tap the child to the "Yay" success message. ▶ Fixed - Re-equiping now resets the parent-ator. 7) Parenting can be broken with this. On occasions the Parentator seems to get out of sequence. With a group of objects eventually one or more can get orphaned. In effect (occasionally ) a single first tap can produce the success message. ▶ Believed to be fixed - I was unable to really reproduce the problem but the fix for the previous item should fix this too, I believe. 8) There is an error in the description on line 7 of parentator.js ▶ Fixed - Changed reference to pingpong gun to parent-ator 9) Equipping can fail with a smaller than normal avatar as the offsets are hard coded rather than scaled relative to the user's scale. ▶ Fixed - I realized I was adding the entity with larger dimensions than the model normally had. I've scaled it down to where it should be and I think this has solved the issue.
2017-07-26 12:14:59 -06:00
Entities.deleteEntity( this.entityID );
}
// entity scripts always need to return a newly constructed object of our type
return new Parentator();
});