From 8aa7228e5427752211f35c4ad6485d82ce264b0d Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 19 Nov 2015 16:19:00 -0800 Subject: [PATCH] fixed offsets --- examples/weapons/pistol/pistol.js | 7 ++++--- examples/weapons/pistol/pistolSpawner.js | 20 ++++++++++++++++---- examples/weapons/shootingRangeSpawner.js | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/examples/weapons/pistol/pistol.js b/examples/weapons/pistol/pistol.js index 966063babc..834f021d42 100644 --- a/examples/weapons/pistol/pistol.js +++ b/examples/weapons/pistol/pistol.js @@ -26,11 +26,12 @@ _this = this; this.equipped = false; this.forceMultiplier = 1; + this.laserLength = 100; this.laserOffsets = { - y: .15, + y: .095 }; this.firingOffsets = { - z: 0.3 + z: 0.16 } this.fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw"); this.fireVolume = 0.5; @@ -79,7 +80,7 @@ this.firingDirection = Quat.getFront(rotation); var upVec = Quat.getUp(rotation); this.barrelPoint = Vec3.sum(position, Vec3.multiply(upVec, this.laserOffsets.y)); - var laserTip = Vec3.sum(this.barrelPoint, Vec3.multiply(this.firingDirection, 10)); + var laserTip = Vec3.sum(this.barrelPoint, Vec3.multiply(this.firingDirection, this.laserLength)); this.barrelPoint = Vec3.sum(this.barrelPoint, Vec3.multiply(this.firingDirection, this.firingOffsets.z)) Overlays.editOverlay(this.laser, { start: this.barrelPoint, diff --git a/examples/weapons/pistol/pistolSpawner.js b/examples/weapons/pistol/pistolSpawner.js index 8d43c3c8a2..704edc04c4 100644 --- a/examples/weapons/pistol/pistolSpawner.js +++ b/examples/weapons/pistol/pistolSpawner.js @@ -7,16 +7,28 @@ var pistol = Entities.addEntity({ type: 'Model', modelURL: modelURL, position: center, - dimensions: {x: 0.08, y: .38, z: .6}, + dimensions: { + x: 0.05, + y: .23, + z: .36 + }, script: scriptURL, - color: {red: 200, green: 0, blue: 20}, + color: { + red: 200, + green: 0, + blue: 20 + }, shapeType: 'box', collisionsWillMove: true, userData: JSON.stringify({ grabbableKey: { spatialKey: { - relativePosition: {x: 0, y: 0, z: 0}, - relativeRotation: Quat.fromPitchYawRollDegrees(45, 90 , 0) + relativePosition: { + x: 0, + y: 0, + z: 0 + }, + relativeRotation: Quat.fromPitchYawRollDegrees(45, 90, 0) }, invertSolidWhileHeld: true } diff --git a/examples/weapons/shootingRangeSpawner.js b/examples/weapons/shootingRangeSpawner.js index 11b4c0cd11..3686960cc9 100644 --- a/examples/weapons/shootingRangeSpawner.js +++ b/examples/weapons/shootingRangeSpawner.js @@ -22,7 +22,7 @@ var shootingRangeFloor = Entities.addEntity({ }) var monsterPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation()))); -var monsterURL = "file:///C:/Users/Eric/Desktop/shootingRange/monster1.fbx?v3" +var monsterURL = "file:///C:/Users/Eric/Desktop/shootingRange/monster2.fbx?v5" var monster = Entities.addEntity({ type: "Model", modelURL: monsterURL,