mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-27 06:58:48 +02:00
fixed offsets
This commit is contained in:
parent
947d04e7f1
commit
8aa7228e54
3 changed files with 21 additions and 8 deletions
|
@ -26,11 +26,12 @@
|
||||||
_this = this;
|
_this = this;
|
||||||
this.equipped = false;
|
this.equipped = false;
|
||||||
this.forceMultiplier = 1;
|
this.forceMultiplier = 1;
|
||||||
|
this.laserLength = 100;
|
||||||
this.laserOffsets = {
|
this.laserOffsets = {
|
||||||
y: .15,
|
y: .095
|
||||||
};
|
};
|
||||||
this.firingOffsets = {
|
this.firingOffsets = {
|
||||||
z: 0.3
|
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.fireVolume = 0.5;
|
this.fireVolume = 0.5;
|
||||||
|
@ -79,7 +80,7 @@
|
||||||
this.firingDirection = Quat.getFront(rotation);
|
this.firingDirection = Quat.getFront(rotation);
|
||||||
var upVec = Quat.getUp(rotation);
|
var upVec = Quat.getUp(rotation);
|
||||||
this.barrelPoint = Vec3.sum(position, Vec3.multiply(upVec, this.laserOffsets.y));
|
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))
|
this.barrelPoint = Vec3.sum(this.barrelPoint, Vec3.multiply(this.firingDirection, this.firingOffsets.z))
|
||||||
Overlays.editOverlay(this.laser, {
|
Overlays.editOverlay(this.laser, {
|
||||||
start: this.barrelPoint,
|
start: this.barrelPoint,
|
||||||
|
|
|
@ -7,16 +7,28 @@ var pistol = Entities.addEntity({
|
||||||
type: 'Model',
|
type: 'Model',
|
||||||
modelURL: modelURL,
|
modelURL: modelURL,
|
||||||
position: center,
|
position: center,
|
||||||
dimensions: {x: 0.08, y: .38, z: .6},
|
dimensions: {
|
||||||
|
x: 0.05,
|
||||||
|
y: .23,
|
||||||
|
z: .36
|
||||||
|
},
|
||||||
script: scriptURL,
|
script: scriptURL,
|
||||||
color: {red: 200, green: 0, blue: 20},
|
color: {
|
||||||
|
red: 200,
|
||||||
|
green: 0,
|
||||||
|
blue: 20
|
||||||
|
},
|
||||||
shapeType: 'box',
|
shapeType: 'box',
|
||||||
collisionsWillMove: true,
|
collisionsWillMove: true,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
spatialKey: {
|
spatialKey: {
|
||||||
relativePosition: {x: 0, y: 0, z: 0},
|
relativePosition: {
|
||||||
relativeRotation: Quat.fromPitchYawRollDegrees(45, 90 , 0)
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
|
relativeRotation: Quat.fromPitchYawRollDegrees(45, 90, 0)
|
||||||
},
|
},
|
||||||
invertSolidWhileHeld: true
|
invertSolidWhileHeld: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ var shootingRangeFloor = Entities.addEntity({
|
||||||
})
|
})
|
||||||
|
|
||||||
var monsterPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation())));
|
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({
|
var monster = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: monsterURL,
|
modelURL: monsterURL,
|
||||||
|
|
Loading…
Reference in a new issue