mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:37:48 +02:00
update ping pong gun model url
This commit is contained in:
parent
78b608b970
commit
9a860bd31a
4 changed files with 64 additions and 49 deletions
|
@ -11,53 +11,63 @@
|
||||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("../../libraries/utils.js");
|
||||||
|
|
||||||
var scriptURL = Script.resolvePath('pingPongGun.js');
|
var scriptURL = Script.resolvePath('pingPongGun.js?' + Math.random());
|
||||||
|
|
||||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_gun.fbx'
|
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx'
|
||||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_gun_convex.obj';
|
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
||||||
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
||||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0.5,
|
y: 0.5,
|
||||||
z: 0
|
z: 0
|
||||||
}), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation())));
|
}), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation())));
|
||||||
|
|
||||||
var pingPongGun = Entities.addEntity({
|
var pingPongGun = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: MODEL_URL,
|
modelURL: MODEL_URL,
|
||||||
shapeType: 'compound',
|
shapeType: 'compound',
|
||||||
compoundShapeURL: COLLISION_HULL_URL,
|
compoundShapeURL: COLLISION_HULL_URL,
|
||||||
script: scriptURL,
|
script: scriptURL,
|
||||||
position: center,
|
position: center,
|
||||||
dimensions: {
|
dimensions: {
|
||||||
x: 0.08,
|
x: 0.08,
|
||||||
y: 0.21,
|
y: 0.21,
|
||||||
z: 0.47
|
z: 0.47
|
||||||
|
},
|
||||||
|
dynamic: true,
|
||||||
|
collisionSoundURL: COLLISION_SOUND_URL,
|
||||||
|
userData: JSON.stringify({
|
||||||
|
grabbableKey: {
|
||||||
|
invertSolidWhileHeld: true
|
||||||
},
|
},
|
||||||
dynamic: true,
|
wearable: {
|
||||||
collisionSoundURL: COLLISION_SOUND_URL,
|
joints: {
|
||||||
userData: JSON.stringify({
|
RightHand: [{
|
||||||
grabbableKey: {
|
x: 0.1177130937576294,
|
||||||
invertSolidWhileHeld: true
|
y: 0.12922893464565277,
|
||||||
},
|
z: 0.08307232707738876
|
||||||
wearable:{joints:{RightHand:[{x:0.1177130937576294,
|
}, {
|
||||||
y:0.12922893464565277,
|
x: 0.4934672713279724,
|
||||||
z:0.08307232707738876},
|
y: 0.3605862259864807,
|
||||||
{x:0.4934672713279724,
|
z: 0.6394805908203125,
|
||||||
y:0.3605862259864807,
|
w: -0.4664038419723511
|
||||||
z:0.6394805908203125,
|
}],
|
||||||
w:-0.4664038419723511}],
|
LeftHand: [{
|
||||||
LeftHand:[{x:0.09151676297187805,
|
x: 0.09151676297187805,
|
||||||
y:0.13639454543590546,
|
y: 0.13639454543590546,
|
||||||
z:0.09354984760284424},
|
z: 0.09354984760284424
|
||||||
{x:-0.19628101587295532,
|
}, {
|
||||||
y:0.6418180465698242,
|
x: -0.19628101587295532,
|
||||||
z:0.2830369472503662,
|
y: 0.6418180465698242,
|
||||||
w:0.6851521730422974}]}}
|
z: 0.2830369472503662,
|
||||||
})
|
w: 0.6851521730422974
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
function cleanUp() {
|
function cleanUp() {
|
||||||
Entities.deleteEntity(pingPongGun);
|
Entities.deleteEntity(pingPongGun);
|
||||||
}
|
}
|
||||||
Script.scriptEnding.connect(cleanUp);
|
Script.scriptEnding.connect(cleanUp);
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
//if the trigger value goes below this value, reload the gun.
|
//if the trigger value goes below this value, reload the gun.
|
||||||
var RELOAD_THRESHOLD = 0.95;
|
var RELOAD_THRESHOLD = 0.95;
|
||||||
var GUN_TIP_FWD_OFFSET =-0.35;
|
var GUN_TIP_FWD_OFFSET = -0.35;
|
||||||
var GUN_TIP_UP_OFFSET = 0.040;
|
var GUN_TIP_UP_OFFSET = 0.040;
|
||||||
var GUN_FORCE = 9;
|
var GUN_FORCE = 9;
|
||||||
var BALL_RESTITUTION = 0.6;
|
var BALL_RESTITUTION = 0.6;
|
||||||
|
@ -45,12 +45,12 @@
|
||||||
green: 255,
|
green: 255,
|
||||||
blue: 255
|
blue: 255
|
||||||
};
|
};
|
||||||
|
|
||||||
var TRIGGER_CONTROLS = [
|
var TRIGGER_CONTROLS = [
|
||||||
Controller.Standard.LT,
|
Controller.Standard.LT,
|
||||||
Controller.Standard.RT,
|
Controller.Standard.RT,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
PingPongGun.prototype = {
|
PingPongGun.prototype = {
|
||||||
hand: null,
|
hand: null,
|
||||||
|
@ -98,8 +98,8 @@
|
||||||
var properties = {
|
var properties = {
|
||||||
// type: 'Model',
|
// type: 'Model',
|
||||||
// modelURL:PING_PONG_BALL_URL,
|
// modelURL:PING_PONG_BALL_URL,
|
||||||
shapeType:'sphere',
|
shapeType: 'sphere',
|
||||||
type:'Sphere',
|
type: 'Sphere',
|
||||||
color: BALL_COLOR,
|
color: BALL_COLOR,
|
||||||
dimensions: BALL_DIMENSIONS,
|
dimensions: BALL_DIMENSIONS,
|
||||||
damping: BALL_LINEAR_DAMPING,
|
damping: BALL_LINEAR_DAMPING,
|
||||||
|
@ -126,6 +126,10 @@
|
||||||
Audio.playSound(this.SHOOTING_SOUND, audioProperties);
|
Audio.playSound(this.SHOOTING_SOUND, audioProperties);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clickDownOnEntity: function(entityID, mouseEvent) {
|
||||||
|
this.shootBall()
|
||||||
|
},
|
||||||
|
|
||||||
getGunTipPosition: function(properties) {
|
getGunTipPosition: function(properties) {
|
||||||
//the tip of the gun is going to be in a different place than the center, so we move in space relative to the model to find that position
|
//the tip of the gun is going to be in a different place than the center, so we move in space relative to the model to find that position
|
||||||
var frontVector = Quat.getFront(properties.rotation);
|
var frontVector = Quat.getFront(properties.rotation);
|
||||||
|
@ -148,4 +152,4 @@
|
||||||
|
|
||||||
// entity scripts always need to return a newly constructed object of our type
|
// entity scripts always need to return a newly constructed object of our type
|
||||||
return new PingPongGun();
|
return new PingPongGun();
|
||||||
});
|
});
|
|
@ -1241,8 +1241,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPingPongBallGun() {
|
function createPingPongBallGun() {
|
||||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_gun.fbx';
|
|
||||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_gun_convex.obj';
|
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx';
|
||||||
|
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
||||||
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
||||||
var position = {
|
var position = {
|
||||||
x: 548.6,
|
x: 548.6,
|
||||||
|
|
|
@ -720,8 +720,8 @@ MasterReset = function() {
|
||||||
|
|
||||||
function createTargets() {
|
function createTargets() {
|
||||||
|
|
||||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
|
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx';
|
||||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
|
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
||||||
|
|
||||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||||
var RESET_DISTANCE = 0.5;
|
var RESET_DISTANCE = 0.5;
|
||||||
|
|
Loading…
Reference in a new issue