Bubbles Working Well

This commit is contained in:
Luis Fernando Molina committed 2018-05-05 13:27:08 +02:00
1 parent 20b88dfc0e
commit 609824da95
3 files changed
+52 -2

No files matched your search

Binary file not shown.
+51 -1
View File
@@ -238,7 +238,7 @@ function newFloatingLayer() {
floatingObject.drawForeground();
}
/* Finally we check if any of the created FloatingObjects where enabled to run under the Physics Engine. */
/* Now we check if any of the created FloatingObjects where enabled to run under the Physics Engine. */
for (let i = 0; i < innactiveFloatingObjects.length; i++) {
@@ -294,6 +294,56 @@ function newFloatingLayer() {
}
}
/* Finally we check if any of the currently visible floatingObjects has become invisible and must be removed from the Physics Engine. */
for (let i = 0; i < thisObject.floatingObjects.length; i++) {
let floatingObject = thisObject.floatingObjects[i];
let payload = {
position: undefined,
visible: true
};
switch (floatingObject.type) {
case "Profile Ball": {
payload.visible = floatingObject.payload.profile.visible;
break;
}
case "Bubble": {
payload.visible = floatingObject.payload.bubbles[floatingObject.payloadBubbleIndex].visible;
break;
}
default: {
break;
}
}
if (payload.visible === false) {
if (INFO_LOG === true) { logger.write("[INFO] physicsLoop -> payload.visible = " + payload.visible); }
innactiveFloatingObjects.push(floatingObject);
if (INFO_LOG === true) { logger.write("[INFO] physicsLoop -> floatingObject.handle = " + floatingObject.handle); }
if (INFO_LOG === true) { logger.write("[INFO] physicsLoop -> floatingObject added to innactiveFloatingObjects"); }
if (INFO_LOG === true) { logger.write("[INFO] physicsLoop -> innactiveFloatingObjects.length = " + innactiveFloatingObjects.length); }
thisObject.floatingObjects.splice(i, 1); // Delete item from array.
if (INFO_LOG === true) { logger.write("[INFO] physicsLoop -> floatingObject.handle = " + floatingObject.handle); }
if (INFO_LOG === true) { logger.write("[INFO] physicsLoop -> floatingObject removed from thisObject.floatingObjects"); }
if (INFO_LOG === true) { logger.write("[INFO] physicsLoop -> thisObject.floatingObjects.length = " + thisObject.floatingObjects.length); }
return; // Only one at the time.
}
}
}
function gravityForce(floatingObject, payload) {
+1 -1
View File
@@ -6,7 +6,7 @@ if (CONSOLE_LOG === true) {
}
const DEBUG_MODE = true; // This forces the server to read Plotters from the local drive.
const DEBUG_MODE = false; // This forces the server to read Plotters from the local drive.
if (CONSOLE_LOG === true && DEBUG_MODE === true) {