Pārlūkot izejas kodu

Adding physics plugin names

To be able to serialize the plugins, they require each a name.
Weber, Raanan 9 gadi atpakaļ
vecāks
revīzija
ddf7ac3750

+ 2 - 0
src/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -17,6 +17,8 @@
         private _world: any;
         private _registeredMeshes: Array<IRegisteredMesh> = [];
         private _physicsMaterials = [];
+		
+		public name = "cannon";
 
         public initialize(iterations: number = 10): void {
             this._world = new CANNON.World();

+ 2 - 0
src/Physics/Plugins/babylon.oimoJSPlugin.ts

@@ -4,6 +4,8 @@ module BABYLON {
     export class OimoJSPlugin implements IPhysicsEnginePlugin {
         private _world;
         private _registeredMeshes = [];
+		
+		public name = "oimo";
 
         private _checkWithEpsilon(value: number): number {
             return value < PhysicsEngine.Epsilon ? PhysicsEngine.Epsilon : value;

+ 5 - 0
src/Physics/babylon.physicsEngine.ts

@@ -1,5 +1,6 @@
 module BABYLON {
     export interface IPhysicsEnginePlugin {
+		name: string;
         initialize(iterations?: number);
         setGravity(gravity: Vector3): void;
         runOneStep(delta: number): void;
@@ -90,6 +91,10 @@
         public getPhysicsBodyOfMesh(mesh: AbstractMesh) {
             return this._currentPlugin.getPhysicsBodyOfMesh(mesh);
         }
+		
+		public getPhysicsPluginName() : string {
+			return this._currentPlugin.name;
+		}
 
         // Statics
         public static NoImpostor = 0;