mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +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
|
||||
}
|
||||
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.bulletForce = 10;
|
||||
|
||||
|
@ -67,7 +69,7 @@
|
|||
});
|
||||
} else if (this.triggerValue >= DISABLE_LASER_THRESHOLD && this.showLaser === false) {
|
||||
this.showLaser = true
|
||||
Overlays.editOverlay(this.laser, {
|
||||
Overlays.editOverlay(this.laser, {
|
||||
visible: true
|
||||
});
|
||||
}
|
||||
|
@ -126,10 +128,19 @@
|
|||
position: this.barrelPoint,
|
||||
volume: this.fireVolume
|
||||
});
|
||||
|
||||
this.createGunFireEffect(this.barrelPoint)
|
||||
var intersection = Entities.findRayIntersectionBlocking(pickRay, true);
|
||||
if (intersection.intersects) {
|
||||
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) {
|
||||
// Any entity with collisions will move can be shot
|
||||
Entities.editEntity(intersection.entityID, {
|
||||
|
|
|
@ -20,6 +20,7 @@ var pistol = Entities.addEntity({
|
|||
},
|
||||
shapeType: 'box',
|
||||
collisionsWillMove: true,
|
||||
collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav",
|
||||
userData: JSON.stringify({
|
||||
grabbableKey: {
|
||||
spatialKey: {
|
||||
|
|
|
@ -164,6 +164,7 @@
|
|||
name: "pistol",
|
||||
modelURL: modelURL,
|
||||
position: position,
|
||||
collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav",
|
||||
dimensions: {
|
||||
x: 0.05,
|
||||
y: .23,
|
||||
|
|
|
@ -155,6 +155,7 @@ MasterReset = function() {
|
|||
shapeType: 'box',
|
||||
gravity: {x: 0, y: -3.0, z: 0},
|
||||
collisionsWillMove: true,
|
||||
collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav",
|
||||
userData: JSON.stringify({
|
||||
grabbableKey: {
|
||||
spatialKey: {
|
||||
|
|
Loading…
Reference in a new issue