content/hifi-content/DomainContent/Welcome Area/Scripts/gloveAttacherJan6.js
2022-02-13 22:49:05 +01:00

83 lines
3.1 KiB
JavaScript

//
// gloveAttacher.js
//
(function() {
this.startFarTrigger = this.startNearTrigger = function(entityID, args) {
var hand = args[0];
if (hand === 'left') {
var leftGlove = Entities.addEntity({
position: MyAvatar.position,
// collisionSoundURL: "http://hifi-content.s3.amazonaws.com/caitlyn/production/elBoppo/51460__andre-rocha-nascimento__basket-ball-01-bounce.wav",
collisionsWillMove: true,
dimensions: {
x: 0.3316, //size of object
y: 0.4445,
z: 0.1691
},
dynamic: true,
gravity: {
x: 0,
y: -9.8,
z: 0
},
modelURL: "https://hifi-content.s3.amazonaws.com/jimi/props/sportsHands/sportsHand_Thick_L.fbx",
name: "Boxing Glove - Left",
shapeType: "simple-hull",
type: "Model",
lifetime: 1800,
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true
},
wearable: {
joints: {
LeftHand: [
{x: -0.05, y: 0.2, z: 0.03 }, //position on joint
Quat.fromVec3Degrees({x: 0, y: 0, z: 0}) //rotation
]
}
}
})
});
Messages.sendLocalMessage('Hifi-Hand-Grab', JSON.stringify({hand: 'left', entityID: leftGlove}));
return;
}
var rightGlove = Entities.addEntity({
position: MyAvatar.position,
// collisionSoundURL: "http://hifi-content.s3.amazonaws.com/caitlyn/production/elBoppo/51460__andre-rocha-nascimento__basket-ball-01-bounce.wav",
collisionsWillMove: true,
dimensions: {
x: 0.3316, //size of object
y: 0.4445,
z: 0.1691
},
dynamic: true,
gravity: {
x: 0,
y: -9.8,
z: 0
},
modelURL: "https://hifi-content.s3.amazonaws.com/jimi/props/sportsHands/sportsHand_Thick_R.fbx",
name: "Boxing Glove - Right",
shapeType: "simple-hull",
type: "Model",
lifetime: 1800,
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true
},
wearable: {
joints: {
RightHand: [
{x: 0.05, y: 0.2, z: 0.03 },
Quat.fromVec3Degrees({x: 0, y: 0, z: 0})
]
}
}
})
});
Messages.sendLocalMessage('Hifi-Hand-Grab', JSON.stringify({hand: 'right', entityID: rightGlove}));
};
})