Selaa lähdekoodia

Small typos in oimo plugin

David Catuhe 11 vuotta sitten
vanhempi
commit
db75b7e531

+ 32 - 31
Babylon/Physics/Plugins/babylon.oimoJSPlugin.js

@@ -3,37 +3,6 @@ var BABYLON;
     var OimoJSPlugin = (function () {
         function OimoJSPlugin() {
             this._registeredMeshes = [];
-            this.registerMeshesAsCompound = function (parts, options) {
-                var types = [], sizes = [], positions = [], rotations = [];
-
-                var initialMesh = parts[0].mesh;
-
-                for (var index = 0; index < parts.length; index++) {
-                    var part = parts[index];
-                    var bodyParameters = this._createBodyAsCompound(part, options, initialMesh);
-                    types.push(bodyParameters.type);
-                    sizes.push.apply(sizes, bodyParameters.size);
-                    positions.push.apply(positions, bodyParameters.pos);
-                    rotations.push.apply(rotations, bodyParameters.rot);
-                }
-
-                var body = new OIMO.Body({
-                    type: types,
-                    size: sizes,
-                    pos: positions,
-                    rot: rotations,
-                    move: options.mass != 0,
-                    config: [options.mass, options.friction, options.restitution],
-                    world: this.world
-                });
-
-                this._registeredMeshes.push({
-                    mesh: initialMesh,
-                    body: body
-                });
-
-                return body;
-            };
             /**
             * Update the body position according to the mesh position
             * @param mesh
@@ -139,6 +108,38 @@ var BABYLON;
             return body;
         };
 
+        OimoJSPlugin.prototype.registerMeshesAsCompound = function (parts, options) {
+            var types = [], sizes = [], positions = [], rotations = [];
+
+            var initialMesh = parts[0].mesh;
+
+            for (var index = 0; index < parts.length; index++) {
+                var part = parts[index];
+                var bodyParameters = this._createBodyAsCompound(part, options, initialMesh);
+                types.push(bodyParameters.type);
+                sizes.push.apply(sizes, bodyParameters.size);
+                positions.push.apply(positions, bodyParameters.pos);
+                rotations.push.apply(rotations, bodyParameters.rot);
+            }
+
+            var body = new OIMO.Body({
+                type: types,
+                size: sizes,
+                pos: positions,
+                rot: rotations,
+                move: options.mass != 0,
+                config: [options.mass, options.friction, options.restitution],
+                world: this._world
+            });
+
+            this._registeredMeshes.push({
+                mesh: initialMesh,
+                body: body
+            });
+
+            return body;
+        };
+
         OimoJSPlugin.prototype._createBodyAsCompound = function (part, options, initialMesh) {
             var bodyParameters = null;
             var mesh = part.mesh;

+ 3 - 3
Babylon/Physics/Plugins/babylon.oimoJSPlugin.ts

@@ -63,7 +63,7 @@ module BABYLON {
             return body;
         }
 
-        public registerMeshesAsCompound = function (parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any {
+        public registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any {
             var types = [],
                 sizes = [],
                 positions = [],
@@ -210,7 +210,7 @@ module BABYLON {
                 pos1: [pivot1.x, pivot1.y, pivot1.z],
                 collision: options.collision,
                 spring: options.spring,
-                world: this._world
+                world: this.world
             });
 
             return true;
@@ -276,4 +276,4 @@ module BABYLON {
             }
         }
     }
-}
+}