From d2b3c7bf4cbceeb44e68b7a00b24625d4cd936ed Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 27 Oct 2017 15:31:51 +0200 Subject: [PATCH] get physics better --- src/game-lib-a-1-event.js | 8 ++++---- src/game-lib-d3-mesh-plane.js | 8 ++++---- src/game-lib-d3-mesh-sphere.js | 8 ++++---- src/game-lib-system-linking.js | 1 - 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/game-lib-a-1-event.js b/src/game-lib-a-1-event.js index 659a081..6255f75 100644 --- a/src/game-lib-a-1-event.js +++ b/src/game-lib-a-1-event.js @@ -79,7 +79,7 @@ GameLib.Event.STOP_VISUALIZE = 0x3d; GameLib.Event.FETCH_COMPONENT_TYPES = 0x3e; GameLib.Event.FETCH_COMPONENTS = 0x3f; GameLib.Event.GET_API_URL = 0x40; -GameLib.Event.GET_PHYSICS_ENGINE = 0x41; +GameLib.Event.GET_PHYSICS_IMPLEMENTATION = 0x41; GameLib.Event.PARENT_WORLD_CHANGE = 0x42; GameLib.Event.ANIMATE = 0x43; GameLib.Event.ANIMATION_COMPILE_SUCCESS = 0x44; @@ -93,7 +93,7 @@ GameLib.Event.TOUCH_MOVE = 0x4b; GameLib.Event.TOUCH_CANCEL = 0x4c; GameLib.Event.GET_REMOTE_API_URL = 0x4d; GameLib.Event.GET_GRAPHICS_IMPLEMENTATION = 0x4e; -GameLib.Event.GET_PHYSICS_IMPLEMENTATION = 0x4f; +GameLib.Event.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX = 0x4f; GameLib.Event.GET_CODER_IMPLEMENTATION = 0x50; GameLib.Event.ANIMATION_MESH_ADDED = 0x51; GameLib.Event.ANIMATION_MESH_REMOVED = 0x52; @@ -181,7 +181,7 @@ GameLib.Event.GetEventName = function(number) { case 0x3e : return 'fetch_component_types'; case 0x3f : return 'fetch_components'; case 0x40 : return 'get_api_url'; - case 0x41 : return 'get_physics_engine'; + case 0x41 : return 'get_physics_implementation'; case 0x42 : return 'parent_world_change'; case 0x43 : return 'animate'; case 0x44 : return 'animation_compile_success'; @@ -195,7 +195,7 @@ GameLib.Event.GetEventName = function(number) { case 0x4c : return 'touch_cancel'; case 0x4d : return 'get_remote_api_url'; case 0x4e : return 'get_graphics_implementation'; - case 0x4f : return 'get_physics_implementation'; + case 0x4f : return 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'; case 0x50 : return 'get_coder_implementation'; case 0x51 : return 'animation_mesh_added'; case 0x52 : return 'animation_mesh_removed'; diff --git a/src/game-lib-d3-mesh-plane.js b/src/game-lib-d3-mesh-plane.js index 06e1da8..ffe205b 100644 --- a/src/game-lib-d3-mesh-plane.js +++ b/src/game-lib-d3-mesh-plane.js @@ -315,9 +315,9 @@ GameLib.D3.Mesh.Plane.prototype.generateHeightMapFromBumpMap = function() { GameLib.D3.Mesh.Plane.prototype.createPhysicsObjects = function() { GameLib.Event.Emit( - GameLib.Event.GET_PHYSICS_ENGINE, + GameLib.Event.GET_PHYSICS_IMPLEMENTATION, null, - function(data){ + function(physics){ /** * Create the plane shape @@ -331,7 +331,7 @@ GameLib.D3.Mesh.Plane.prototype.createPhysicsObjects = function() { apiShapePlane.parentMesh = this; var shapePlane = new GameLib.D3.Shape.Plane( - data.physics, + physics, apiShapePlane ); @@ -368,7 +368,7 @@ GameLib.D3.Mesh.Plane.prototype.createPhysicsObjects = function() { * @type {GameLib.D3.RigidBody} */ var rigidBody = new GameLib.D3.RigidBody( - data.physics, + physics, apiRigidBody ); diff --git a/src/game-lib-d3-mesh-sphere.js b/src/game-lib-d3-mesh-sphere.js index 3c7af56..3ae9d75 100644 --- a/src/game-lib-d3-mesh-sphere.js +++ b/src/game-lib-d3-mesh-sphere.js @@ -110,9 +110,9 @@ GameLib.D3.Mesh.Sphere.prototype.toApiObject = function() { GameLib.D3.Mesh.Sphere.prototype.createPhysicsObjects = function() { GameLib.Event.Emit( - GameLib.Event.GET_PHYSICS_ENGINE, + GameLib.Event.GET_PHYSICS_IMPLEMENTATION, null, - function(data){ + function(physics){ var apiShapeSphere = new GameLib.D3.API.Shape( null, 'Sphere Shape (' + this.name + ')' @@ -121,7 +121,7 @@ GameLib.D3.Mesh.Sphere.prototype.createPhysicsObjects = function() { apiShapeSphere.parentMesh = this; var shapeSphere = new GameLib.D3.Shape.Sphere( - data.physics, + physics, apiShapeSphere, this.radius ); @@ -155,7 +155,7 @@ GameLib.D3.Mesh.Sphere.prototype.createPhysicsObjects = function() { apiRigidBody.shapes.push(shapeSphere); var rigidBody = new GameLib.D3.RigidBody( - data.physics, + physics, apiRigidBody ); diff --git a/src/game-lib-system-linking.js b/src/game-lib-system-linking.js index 7b3def0..597078b 100644 --- a/src/game-lib-system-linking.js +++ b/src/game-lib-system-linking.js @@ -174,7 +174,6 @@ GameLib.System.Linking.prototype.start = function() { this.physicsWorldInstanceCreated ); - /** * Meshes */