mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 13:11:43 +02:00
Convert billboard display to feet and cleanup trails earlier
This commit is contained in:
parent
8a29f4fc61
commit
03a082383f
1 changed files with 6 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
Script.include("line.js");
|
Script.include("line.js");
|
||||||
|
|
||||||
var DISTANCE_BILLBOARD_ENTITY_ID = "{5fe0daf5-3fc5-43e3-a4eb-81a8e840a52b}";
|
var DISTANCE_BILLBOARD_ENTITY_ID = "{5fe0daf5-3fc5-43e3-a4eb-81a8e840a52b}";
|
||||||
|
var METERS_TO_FEET = 3.28084;
|
||||||
|
|
||||||
var AUDIO = {
|
var AUDIO = {
|
||||||
crowdBoos: [
|
crowdBoos: [
|
||||||
|
@ -163,9 +164,9 @@ function playRandomSound(sounds, options) {
|
||||||
|
|
||||||
function vec3Mult(a, b) {
|
function vec3Mult(a, b) {
|
||||||
return {
|
return {
|
||||||
x: a.x * b.x,
|
x: a.x * b.x,
|
||||||
y: a.y * b.y,
|
y: a.y * b.y,
|
||||||
z: a.z * b.z,
|
z: a.z * b.z,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +282,7 @@ Baseball.prototype = {
|
||||||
var myProperties = Entities.getEntityProperties(this.entityID, ['position', 'velocity']);
|
var myProperties = Entities.getEntityProperties(this.entityID, ['position', 'velocity']);
|
||||||
var speed = Vec3.length(myProperties.velocity);
|
var speed = Vec3.length(myProperties.velocity);
|
||||||
this.distanceTravelled = Vec3.distance(this.hitBallAtPosition, myProperties.position);
|
this.distanceTravelled = Vec3.distance(this.hitBallAtPosition, myProperties.position);
|
||||||
updateBillboard(Math.ceil(this.distanceTravelled));
|
updateBillboard(Math.ceil(this.distanceTravelled * METERS_TO_FEET));
|
||||||
if (this.timeSinceHit > 10 || speed < 1) {
|
if (this.timeSinceHit > 10 || speed < 1) {
|
||||||
this.state = BASEBALL_STATE.HIT_LANDED;
|
this.state = BASEBALL_STATE.HIT_LANDED;
|
||||||
print("Ball took " + this.timeSinceHit.toFixed(3) + " seconds to land");
|
print("Ball took " + this.timeSinceHit.toFixed(3) + " seconds to land");
|
||||||
|
@ -383,6 +384,7 @@ Baseball.prototype = {
|
||||||
var baseball = null;
|
var baseball = null;
|
||||||
|
|
||||||
function pitchBall() {
|
function pitchBall() {
|
||||||
|
cleanupTrail();
|
||||||
updateBillboard("");
|
updateBillboard("");
|
||||||
var machineProperties = Entities.getEntityProperties(pitchingMachineID, ["dimensions", "position", "rotation"]);
|
var machineProperties = Entities.getEntityProperties(pitchingMachineID, ["dimensions", "position", "rotation"]);
|
||||||
var pitchFromPositionBase = machineProperties.position;
|
var pitchFromPositionBase = machineProperties.position;
|
||||||
|
|
Loading…
Reference in a new issue