get physics better

beta.r3js.org
-=yb4f310 2017-10-27 15:31:51 +02:00
parent 7b239ebc74
commit d2b3c7bf4c
4 changed files with 12 additions and 13 deletions

View File

@ -79,7 +79,7 @@ GameLib.Event.STOP_VISUALIZE = 0x3d;
GameLib.Event.FETCH_COMPONENT_TYPES = 0x3e; GameLib.Event.FETCH_COMPONENT_TYPES = 0x3e;
GameLib.Event.FETCH_COMPONENTS = 0x3f; GameLib.Event.FETCH_COMPONENTS = 0x3f;
GameLib.Event.GET_API_URL = 0x40; 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.PARENT_WORLD_CHANGE = 0x42;
GameLib.Event.ANIMATE = 0x43; GameLib.Event.ANIMATE = 0x43;
GameLib.Event.ANIMATION_COMPILE_SUCCESS = 0x44; GameLib.Event.ANIMATION_COMPILE_SUCCESS = 0x44;
@ -93,7 +93,7 @@ GameLib.Event.TOUCH_MOVE = 0x4b;
GameLib.Event.TOUCH_CANCEL = 0x4c; GameLib.Event.TOUCH_CANCEL = 0x4c;
GameLib.Event.GET_REMOTE_API_URL = 0x4d; GameLib.Event.GET_REMOTE_API_URL = 0x4d;
GameLib.Event.GET_GRAPHICS_IMPLEMENTATION = 0x4e; GameLib.Event.GET_GRAPHICS_IMPLEMENTATION = 0x4e;
GameLib.Event.GET_PHYSICS_IMPLEMENTATION = 0x4f; GameLib.Event.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX = 0x4f;
GameLib.Event.GET_CODER_IMPLEMENTATION = 0x50; GameLib.Event.GET_CODER_IMPLEMENTATION = 0x50;
GameLib.Event.ANIMATION_MESH_ADDED = 0x51; GameLib.Event.ANIMATION_MESH_ADDED = 0x51;
GameLib.Event.ANIMATION_MESH_REMOVED = 0x52; GameLib.Event.ANIMATION_MESH_REMOVED = 0x52;
@ -181,7 +181,7 @@ GameLib.Event.GetEventName = function(number) {
case 0x3e : return 'fetch_component_types'; case 0x3e : return 'fetch_component_types';
case 0x3f : return 'fetch_components'; case 0x3f : return 'fetch_components';
case 0x40 : return 'get_api_url'; 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 0x42 : return 'parent_world_change';
case 0x43 : return 'animate'; case 0x43 : return 'animate';
case 0x44 : return 'animation_compile_success'; case 0x44 : return 'animation_compile_success';
@ -195,7 +195,7 @@ GameLib.Event.GetEventName = function(number) {
case 0x4c : return 'touch_cancel'; case 0x4c : return 'touch_cancel';
case 0x4d : return 'get_remote_api_url'; case 0x4d : return 'get_remote_api_url';
case 0x4e : return 'get_graphics_implementation'; case 0x4e : return 'get_graphics_implementation';
case 0x4f : return 'get_physics_implementation'; case 0x4f : return 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';
case 0x50 : return 'get_coder_implementation'; case 0x50 : return 'get_coder_implementation';
case 0x51 : return 'animation_mesh_added'; case 0x51 : return 'animation_mesh_added';
case 0x52 : return 'animation_mesh_removed'; case 0x52 : return 'animation_mesh_removed';

View File

@ -315,9 +315,9 @@ GameLib.D3.Mesh.Plane.prototype.generateHeightMapFromBumpMap = function() {
GameLib.D3.Mesh.Plane.prototype.createPhysicsObjects = function() { GameLib.D3.Mesh.Plane.prototype.createPhysicsObjects = function() {
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.GET_PHYSICS_ENGINE, GameLib.Event.GET_PHYSICS_IMPLEMENTATION,
null, null,
function(data){ function(physics){
/** /**
* Create the plane shape * Create the plane shape
@ -331,7 +331,7 @@ GameLib.D3.Mesh.Plane.prototype.createPhysicsObjects = function() {
apiShapePlane.parentMesh = this; apiShapePlane.parentMesh = this;
var shapePlane = new GameLib.D3.Shape.Plane( var shapePlane = new GameLib.D3.Shape.Plane(
data.physics, physics,
apiShapePlane apiShapePlane
); );
@ -368,7 +368,7 @@ GameLib.D3.Mesh.Plane.prototype.createPhysicsObjects = function() {
* @type {GameLib.D3.RigidBody} * @type {GameLib.D3.RigidBody}
*/ */
var rigidBody = new GameLib.D3.RigidBody( var rigidBody = new GameLib.D3.RigidBody(
data.physics, physics,
apiRigidBody apiRigidBody
); );

View File

@ -110,9 +110,9 @@ GameLib.D3.Mesh.Sphere.prototype.toApiObject = function() {
GameLib.D3.Mesh.Sphere.prototype.createPhysicsObjects = function() { GameLib.D3.Mesh.Sphere.prototype.createPhysicsObjects = function() {
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.GET_PHYSICS_ENGINE, GameLib.Event.GET_PHYSICS_IMPLEMENTATION,
null, null,
function(data){ function(physics){
var apiShapeSphere = new GameLib.D3.API.Shape( var apiShapeSphere = new GameLib.D3.API.Shape(
null, null,
'Sphere Shape (' + this.name + ')' 'Sphere Shape (' + this.name + ')'
@ -121,7 +121,7 @@ GameLib.D3.Mesh.Sphere.prototype.createPhysicsObjects = function() {
apiShapeSphere.parentMesh = this; apiShapeSphere.parentMesh = this;
var shapeSphere = new GameLib.D3.Shape.Sphere( var shapeSphere = new GameLib.D3.Shape.Sphere(
data.physics, physics,
apiShapeSphere, apiShapeSphere,
this.radius this.radius
); );
@ -155,7 +155,7 @@ GameLib.D3.Mesh.Sphere.prototype.createPhysicsObjects = function() {
apiRigidBody.shapes.push(shapeSphere); apiRigidBody.shapes.push(shapeSphere);
var rigidBody = new GameLib.D3.RigidBody( var rigidBody = new GameLib.D3.RigidBody(
data.physics, physics,
apiRigidBody apiRigidBody
); );

View File

@ -174,7 +174,6 @@ GameLib.System.Linking.prototype.start = function() {
this.physicsWorldInstanceCreated this.physicsWorldInstanceCreated
); );
/** /**
* Meshes * Meshes
*/ */