mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +02:00
Adding preliminary scripts to repro getChildren issue.
This commit is contained in:
parent
c57b0a957d
commit
986318ccfd
3 changed files with 104 additions and 1 deletions
|
@ -30,7 +30,9 @@ var DEFAULT_SCRIPTS_COMBINED = [
|
|||
"system/dialTone.js",
|
||||
"system/firstPersonHMD.js",
|
||||
"system/tablet-ui/tabletUI.js",
|
||||
"system/emote.js"
|
||||
"system/emote.js",
|
||||
"system/createobject.js",
|
||||
"system/deleteobject.js"
|
||||
];
|
||||
var DEFAULT_SCRIPTS_SEPARATE = [
|
||||
"system/controllers/controllerScripts.js"
|
||||
|
|
60
scripts/system/createobject.js
Normal file
60
scripts/system/createobject.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
(function(){
|
||||
var button;
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
||||
function createEntity(description, position, parent) {
|
||||
var entity = Entities.addEntity({
|
||||
type: "Sphere",
|
||||
position: position,
|
||||
dimensions: Vec3.HALF,
|
||||
dynamic: true,
|
||||
collisionless: true,
|
||||
parentID: parent,
|
||||
lifetime: 300 // Delete after 5 minutes.
|
||||
});
|
||||
print(description + ": " + entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
function createBabies() {
|
||||
var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, {x: 0, y: 2, z: -5}));
|
||||
var root = createEntity("Root", position, Uuid.NULL);
|
||||
var ctr;
|
||||
var avatarChildren = [];
|
||||
// make five children.
|
||||
for(var ctr = 0; ctr < 5; ctr++) {
|
||||
avatarChildren.append(CreateEntity("Child" + ctr, Vec3.sum(position, { x: ctr, y: -1, z: ctr }), root));
|
||||
}}
|
||||
|
||||
button = tablet.addButton({
|
||||
icon: "icons/tablet-icons/clap-i.svg",
|
||||
text: "Create OBJ",
|
||||
sortOrder: 1
|
||||
});
|
||||
|
||||
button.clicked.connect(createBabies);
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
button.clicked.disconnect(createBabies);
|
||||
if (tablet) {
|
||||
tablet.removeButton(button);
|
||||
}
|
||||
});
|
||||
|
||||
/* var entityID = Entities.addEntity({*/
|
||||
//type: "Box",
|
||||
//position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.75, z: -5 })),
|
||||
//dimensions: { x: 0.5, y: 0.5, z: 0.5 },
|
||||
//dynamic: true,
|
||||
//collisionless: false,
|
||||
//userData: "{ \"grabbableKey\": { \"grabbable\": true, \"kinematic\": false } }",
|
||||
//lifetime: 300 // Delete after 5 minutes.
|
||||
//});
|
||||
|
||||
/*var actionID = Entities.addAction("slider", entityID, {*/
|
||||
//axis: { x: 0, y: 1, z: 0 },
|
||||
//linearLow: 0,
|
||||
//linearHigh: 0.6
|
||||
/*});*/
|
||||
}());
|
41
scripts/system/deleteobject.js
Normal file
41
scripts/system/deleteobject.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
(function(){
|
||||
var button;
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
||||
function destroyBabies() {
|
||||
var avatarEntityID =
|
||||
for(var ctr = 0; ctr < getChildrenIDs(); ctr++) {
|
||||
avatarChildren.append(CreateEntity("Child" + ctr, Vec3.sum(position, { x: ctr, y: -1, z: ctr }), root));
|
||||
}}
|
||||
|
||||
button = tablet.addButton({
|
||||
icon: "icons/tablet-icons/clap-i.svg",
|
||||
text: "Destroy OBJ",
|
||||
sortOrder: 1
|
||||
});
|
||||
|
||||
button.clicked.connect(createBabies);
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
button.clicked.disconnect(createBabies);
|
||||
if (tablet) {
|
||||
tablet.removeButton(button);
|
||||
}
|
||||
});
|
||||
|
||||
/* var entityID = Entities.addEntity({*/
|
||||
//type: "Box",
|
||||
//position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.75, z: -5 })),
|
||||
//dimensions: { x: 0.5, y: 0.5, z: 0.5 },
|
||||
//dynamic: true,
|
||||
//collisionless: false,
|
||||
//userData: "{ \"grabbableKey\": { \"grabbable\": true, \"kinematic\": false } }",
|
||||
//lifetime: 300 // Delete after 5 minutes.
|
||||
//});
|
||||
|
||||
/*var actionID = Entities.addAction("slider", entityID, {*/
|
||||
//axis: { x: 0, y: 1, z: 0 },
|
||||
//linearLow: 0,
|
||||
//linearHigh: 0.6
|
||||
/*});*/
|
||||
}());
|
Loading…
Reference in a new issue