make ping pong balls bigger and slower, change out gun model and adjust tip calculations, increase volume, add to master reset script

This commit is contained in:
James B. Pollack 2015-10-05 11:16:55 -07:00
parent 588a256304
commit 65ae811c9c
3 changed files with 12 additions and 15 deletions

View file

@ -25,8 +25,9 @@ var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
var pingPongGun = Entities.addEntity({ var pingPongGun = Entities.addEntity({
type: "Model", type: "Model",
modelURL: MODEL_URL, modelURL: MODEL_URL,
shapeType: 'compound', shapeType:'box',
compoundShapeURL: COLLISION_HULL_URL, // shapeType: 'compound',
// compoundShapeURL: COLLISION_HULL_URL,
script: scriptURL, script: scriptURL,
position: center, position: center,
dimensions: { dimensions: {

View file

@ -21,14 +21,14 @@
//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.45; var GUN_TIP_FWD_OFFSET =-0.35;
var GUN_TIP_UP_OFFSET = 0.040; var GUN_TIP_UP_OFFSET = 0.040;
var GUN_FORCE = 8; var GUN_FORCE = 9;
var BALL_RESTITUTION = 0.6; var BALL_RESTITUTION = 0.6;
var BALL_LINEAR_DAMPING = 0.4; var BALL_LINEAR_DAMPING = 0.4;
var BALL_GRAVITY = { var BALL_GRAVITY = {
x: 0, x: 0,
y: -5.8, y: -4.8,
z: 0 z: 0
}; };
@ -68,7 +68,6 @@
}, },
continueNearGrab: function() { continueNearGrab: function() {
if (this.whichHand === null) { if (this.whichHand === null) {
//only set the active hand once -- if we always read the current hand, our 'holding' hand will get overwritten //only set the active hand once -- if we always read the current hand, our 'holding' hand will get overwritten
this.setWhichHand(); this.setWhichHand();
@ -111,7 +110,7 @@
}, },
shootBall: function(gunProperties) { shootBall: function(gunProperties) {
var forwardVec = Quat.getFront(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, -90, 0))); var forwardVec = Quat.getFront(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 180, 0)));
forwardVec = Vec3.normalize(forwardVec); forwardVec = Vec3.normalize(forwardVec);
forwardVec = Vec3.multiply(forwardVec, GUN_FORCE); forwardVec = Vec3.multiply(forwardVec, GUN_FORCE);
@ -136,7 +135,7 @@
playSoundAtCurrentPosition: function(position) { playSoundAtCurrentPosition: function(position) {
var audioProperties = { var audioProperties = {
volume: 0.1, volume: 0.2,
position: position position: position
}; };
@ -145,9 +144,9 @@
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.getRight(properties.rotation); var frontVector = Quat.getFront(properties.rotation);
var frontOffset = Vec3.multiply(frontVector, GUN_TIP_FWD_OFFSET); var frontOffset = Vec3.multiply(frontVector, GUN_TIP_FWD_OFFSET);
var upVector = Quat.getRight(properties.rotation); var upVector = Quat.getUp(properties.rotation);
var upOffset = Vec3.multiply(upVector, GUN_TIP_UP_OFFSET); var upOffset = Vec3.multiply(upVector, GUN_TIP_UP_OFFSET);
var gunTipPosition = Vec3.sum(properties.position, frontOffset); var gunTipPosition = Vec3.sum(properties.position, frontOffset);

View file

@ -457,8 +457,7 @@ function createPingPongBallGun() {
var pingPongGun = Entities.addEntity({ var pingPongGun = Entities.addEntity({
type: "Model", type: "Model",
modelURL: MODEL_URL, modelURL: MODEL_URL,
shapeType: 'compound', shapeType: 'box',
compoundShapeURL: COLLISION_HULL_URL,
script: scriptURL, script: scriptURL,
position: position, position: position,
rotation: rotation, rotation: rotation,
@ -478,8 +477,6 @@ function createPingPongBallGun() {
setEntityCustomData(resetKey, pingPongGun, { setEntityCustomData(resetKey, pingPongGun, {
resetMe: true resetMe: true
}); });
} }
function createBasketballHoop() { function createBasketballHoop() {