mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 20:48:56 +02:00
Added sounds to pistol
This commit is contained in:
parent
125c32b8fc
commit
22efcb1854
4 changed files with 15 additions and 1 deletions
|
@ -34,6 +34,8 @@
|
||||||
z: 0.16
|
z: 0.16
|
||||||
}
|
}
|
||||||
this.fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw");
|
this.fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw");
|
||||||
|
this.ricochetSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/Ricochet.L.wav");
|
||||||
|
this.playRichochetSoundChance = 0.7;
|
||||||
this.fireVolume = 0.5;
|
this.fireVolume = 0.5;
|
||||||
this.bulletForce = 10;
|
this.bulletForce = 10;
|
||||||
|
|
||||||
|
@ -67,7 +69,7 @@
|
||||||
});
|
});
|
||||||
} else if (this.triggerValue >= DISABLE_LASER_THRESHOLD && this.showLaser === false) {
|
} else if (this.triggerValue >= DISABLE_LASER_THRESHOLD && this.showLaser === false) {
|
||||||
this.showLaser = true
|
this.showLaser = true
|
||||||
Overlays.editOverlay(this.laser, {
|
Overlays.editOverlay(this.laser, {
|
||||||
visible: true
|
visible: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -126,10 +128,19 @@
|
||||||
position: this.barrelPoint,
|
position: this.barrelPoint,
|
||||||
volume: this.fireVolume
|
volume: this.fireVolume
|
||||||
});
|
});
|
||||||
|
|
||||||
this.createGunFireEffect(this.barrelPoint)
|
this.createGunFireEffect(this.barrelPoint)
|
||||||
var intersection = Entities.findRayIntersectionBlocking(pickRay, true);
|
var intersection = Entities.findRayIntersectionBlocking(pickRay, true);
|
||||||
if (intersection.intersects) {
|
if (intersection.intersects) {
|
||||||
this.createEntityHitEffect(intersection.intersection);
|
this.createEntityHitEffect(intersection.intersection);
|
||||||
|
if (Math.random() < this.playRichochetSoundChance) {
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
Audio.playSound(_this.ricochetSound, {
|
||||||
|
position: intersection.intersection,
|
||||||
|
volume: _this.fireVolume
|
||||||
|
});
|
||||||
|
}, randFloat(10, 200));
|
||||||
|
}
|
||||||
if (intersection.properties.collisionsWillMove === 1) {
|
if (intersection.properties.collisionsWillMove === 1) {
|
||||||
// Any entity with collisions will move can be shot
|
// Any entity with collisions will move can be shot
|
||||||
Entities.editEntity(intersection.entityID, {
|
Entities.editEntity(intersection.entityID, {
|
||||||
|
|
|
@ -20,6 +20,7 @@ var pistol = Entities.addEntity({
|
||||||
},
|
},
|
||||||
shapeType: 'box',
|
shapeType: 'box',
|
||||||
collisionsWillMove: true,
|
collisionsWillMove: true,
|
||||||
|
collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav",
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
spatialKey: {
|
spatialKey: {
|
||||||
|
|
|
@ -164,6 +164,7 @@
|
||||||
name: "pistol",
|
name: "pistol",
|
||||||
modelURL: modelURL,
|
modelURL: modelURL,
|
||||||
position: position,
|
position: position,
|
||||||
|
collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav",
|
||||||
dimensions: {
|
dimensions: {
|
||||||
x: 0.05,
|
x: 0.05,
|
||||||
y: .23,
|
y: .23,
|
||||||
|
|
|
@ -155,6 +155,7 @@ MasterReset = function() {
|
||||||
shapeType: 'box',
|
shapeType: 'box',
|
||||||
gravity: {x: 0, y: -3.0, z: 0},
|
gravity: {x: 0, y: -3.0, z: 0},
|
||||||
collisionsWillMove: true,
|
collisionsWillMove: true,
|
||||||
|
collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav",
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
spatialKey: {
|
spatialKey: {
|
||||||
|
|
Loading…
Reference in a new issue