fixed offsets

This commit is contained in:
ericrius1 2015-11-19 16:19:00 -08:00
parent 947d04e7f1
commit 8aa7228e54
3 changed files with 21 additions and 8 deletions

View file

@ -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,

View file

@ -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
}

View file

@ -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,