Search the Community
Showing results for tags 'oimojs'.
-
Hey all! I’m a beginner at BabylonJS and ran into a problem. I spent a long time researching how to solve this on the internet, and couldn’t find a solution. I am running a HTML/JavaScript file locally with BabylonJS and my BabylonJS file is unable to see that I am (using a Cannon.js CDN)/(have Cannon.js saved locally) and prints the following error in the console window: BJS - CannonJS is not available. Please make sure you included the js file. BJS - [17:17:19]: Physics Engine CannonJSPlugin cannot be found. Please make sure it is included. This printout happens when I call “scene.enablePhysics();”. My project works just fine otherwise. (More errors appear when I try to use the physics engine that didn’t load, but that isn’t applicable here.) When I don’t enable physics, this error does not occur but of course, the physics engine doesn’t work then. I am using the following for CDN-calling: <script src="https://cdn.babylonjs.com/cannon.js"> When that didn’t work, I tried using the following below after having downloaded a copy of cannon.js (and putting it in the same folder as the .html file that is using BabylonJS). <script src="cannon.js"></script> I feel like I’m missing something very simple, but I’m not sure what it is. Something similar is happening when I try to use Oimo.js (though I would prefer cannon.js). I get the following error for Oimo.js ( “scene.enablePhysics(new BABYLON.Vector3(0,-9.81, 0), new BABYLON.OimoJSPlugin());”): babylon.js:44 Uncaught TypeError: Cannot read property 'World' of undefined at new i (babylon.js:44) at createScene (PlayingAround.html:193) at PlayingAround.html:330 Putting this code in a playground does not make sense because this line of code “scene.enablePhysics();” works just fine in the playground. I was wondering how I could fix this issue. Thanks in advance for the help!
-
I am attempting to create a game in which the player realistically collides with objects (or at least doesn't clip through them), but have run into a bit of a problem. The player must be able to rotate on all axis, as well as translate on all axis. (Local space) See here: http://triblade9.wc.lt/steelprivateer/ However, the player should also collide with the "asteroids" (debug spheres). It was a simple matter getting the engine set up, and the imposters attached to the meshes. (congratulations on making a simple, robust physics engine binding ) The real issue comes when attempting to move/rotate the player. Here's what I've tested: Using the mesh.rotate and translate methods in local space like normal, and updating the body position - Result: Rotations don't work and the body position updating causes lots of jittering.Directly modifying the rotation vector, continue to use translating and updating body position. - Result: Weirdest, most confusing rotation system ever, "forward" seems to be a combination of random axis or something. Example (Yes, I know the rotation coordinates are not global, but the "forward" direction seems off)Using mesh.applyImpulse. - Result: Incredibly finicky to get a solid directional push, very quickly goes berserk when rolling or pitching.Using mesh.moveWithCollision - Result: Similar to #2, but the 'forward' direction seems even weirder.I will upload an example of #2 soon, the Babylon playground isn't working for me with Oimo.js at the moment. EDIT: Example linked.