67 lines
No EOL
1.4 KiB
JavaScript
67 lines
No EOL
1.4 KiB
JavaScript
(function() {
|
|
var _this;
|
|
var leftFist = undefined;
|
|
var rightFist = undefined;
|
|
var jointName = "LeftHandPinky1";
|
|
|
|
// var BUMP_SCRIPT_URL = Script.resolvePath('bumpScript.js');
|
|
|
|
Box = function() {
|
|
_this = this;
|
|
};
|
|
|
|
Box.prototype = {
|
|
entityID: null,
|
|
clickReleaseOnEntity: function() {
|
|
print("clicked!")
|
|
},
|
|
enterEntity: function() {
|
|
print("entered..")
|
|
|
|
var jointID1 = MyAvatar.jointNames.indexOf(jointName);
|
|
leftFist = Entities.addEntity({
|
|
type: "Sphere",
|
|
position: MyAvatar.getJointPosition(jointName),
|
|
parentJointIndex: jointID1,
|
|
parentID: MyAvatar.sessionUUID,
|
|
dimensions: {
|
|
x: 0.2,
|
|
y: 0.2,
|
|
z: 0.2
|
|
},
|
|
visible: true,
|
|
dynamic: true,
|
|
collidesWith: "static,dynamic",
|
|
// script: BUMP_SCRIPT_URL,
|
|
|
|
})
|
|
|
|
var jointID2 = MyAvatar.jointNames.indexOf("RightHandPinky1");
|
|
rightFist = Entities.addEntity({
|
|
type: "Sphere",
|
|
position: MyAvatar.getJointPosition("RightHandPinky1"),
|
|
parentJointIndex: jointID2,
|
|
parentID: MyAvatar.sessionUUID,
|
|
dimensions: {
|
|
x: 0.2,
|
|
y: 0.2,
|
|
z: 0.2
|
|
},
|
|
visible: true,
|
|
dynamic: true,
|
|
collidesWith: "static,dynamic",
|
|
// script: BUMP_SCRIPT_URL,
|
|
|
|
})
|
|
|
|
},
|
|
leaveEntity: function() {
|
|
print("exited..")
|
|
// TODO: delete fist entity
|
|
Entities.deleteEntity(leftFist)
|
|
Entities.deleteEntity(rightFist)
|
|
}
|
|
};
|
|
|
|
return new Box();
|
|
}) |