mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 14:29:35 +02:00
updated rat model
This commit is contained in:
parent
e78a079796
commit
fa244f8670
2 changed files with 19 additions and 4 deletions
|
@ -25,6 +25,7 @@ HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
|||
var fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw");
|
||||
|
||||
var LASER_WIDTH = 2;
|
||||
var GUN_FORCE = 10;
|
||||
var POSE_CONTROLS = [Controller.Standard.LeftHand, Controller.Standard.RightHand];
|
||||
var TRIGGER_CONTROLS = [Controller.Standard.LT, Controller.Standard.RT];
|
||||
var MIN_THROWER_DELAY = 1000;
|
||||
|
@ -61,6 +62,8 @@ var barrelVectors = [0, 0];
|
|||
var barrelTips = [0, 0];
|
||||
var pointer = [];
|
||||
|
||||
var shootAnything = false;
|
||||
|
||||
pointer.push(Overlays.addOverlay("line3d", {
|
||||
start: ZERO_VECTOR,
|
||||
end: ZERO_VECTOR,
|
||||
|
@ -124,9 +127,11 @@ function triggerChanged(side, value) {
|
|||
position: barrelTips[side],
|
||||
volume: 1.0
|
||||
});
|
||||
|
||||
var shotDirection = Vec3.normalize(barrelVectors[side]);
|
||||
var pickRay = {
|
||||
origin: barrelTips[side],
|
||||
direction: Vec3.normalize(barrelVectors[side])
|
||||
direction: shotDirection
|
||||
};
|
||||
createMuzzleFlash(barrelTips[side]);
|
||||
var intersection = Entities.findRayIntersection(pickRay, true);
|
||||
|
@ -134,11 +139,16 @@ function triggerChanged(side, value) {
|
|||
if (intersection.properties.name === "rat") {
|
||||
print("HOLY SHIT YOU JUST HIT A RAT!");
|
||||
var forceDirection = JSON.stringify({
|
||||
forceDirection: barrelVectors[side]
|
||||
forceDirection: shotDirection
|
||||
});
|
||||
Entities.callEntityMethod(intersection.entityID, 'onHit', [forceDirection]);
|
||||
} else {
|
||||
Script.setTimeout(function() {
|
||||
if (shootAnything) {
|
||||
Entities.editEntity(intersection.entityID, {
|
||||
velocity: Vec3.multiply(shotDirection, GUN_FORCE)
|
||||
});
|
||||
}
|
||||
createWallHit(intersection.intersection);
|
||||
}, 50);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
var scriptURL = Script.resolvePath('rat.js');
|
||||
var naturalDimensions = {x: 11.31, y: 3.18, z: 2.19};
|
||||
var sizeScale = 0.1;
|
||||
var dimensions = Vec3.multiply(naturalDimensions, sizeScale);
|
||||
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation())));
|
||||
var rat = Entities.addEntity({
|
||||
type: "Box",
|
||||
type: "Model",
|
||||
modelURL: "https://hifi-public.s3.amazonaws.com/ryan/rat.fbx",
|
||||
name: 'rat',
|
||||
position: center,
|
||||
dimensions: {x: 0.4, y: 0.4, z: 0.4},
|
||||
dimensions: dimensions,
|
||||
shapeType: 'box',
|
||||
color: {red: 200, green: 20, blue: 200},
|
||||
gravity: {x: 0, y: -9.8, z: 0},
|
||||
collisionsWillMove: true,
|
||||
|
|
Loading…
Reference in a new issue