Enabling OimoJs in babylonJS - javascript

I've got a little project running that uses Babylonjs to render a game, I've got the game 'rendering' and am happy with the progress and have decided to add physics, I went with oimojs as its the standard and was informed that 'enabling' it was as simple referencing the oimo.js file and calling:
scene.enablePhysics();
But when I call this I get the following error:
babylonjs.js:20 Uncaught TypeError: OIMO.World is not a constructor
The only thing I can think of is if the error is perhaps the file I'm referencing is the incorrect one? I pulled the file from:
http://lo-th.github.io/labs/
Is there something new you have to do now? Am I missing something? Or am i just silly and referencing the wrong OIMO.js file?

This seems to be a very old question (and I wonder how I missed it so far), but just for future reference -
Babylon.js has the oimo.js version that is tested and working directly in the repository. If you look here - https://github.com/BabylonJS/Babylon.js/tree/master/dist , the Oimo.js file you see there will work the the latest Babylon version.

Related

Issue with Google Tag Manager implementation. "Uncaught TypeError: Wb.set is not a function"

Recently I started having Issues with the Google Tag Manager.
I can't track it to a Tag or a Trigger (activated and deactivated individually to check).
The error started occurring this week (no updates were made to the system or template). I noticed when testing the implementation of a new Tag in GTM. That shortly worked but then this error message started showing in the console. Removing the new Tag didn't change the situation and since the code worked for a while (some 30minutes) I don't expect a direct relationship between the new tag and the error.
All I have is the console in the frontend that shows the following error message:
Uncaught TypeError: Wb.set is not a function
The error stems from this file:
https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX
Wb is started as a Map just a few steps earlier:
Wb=new Map(Vb.h.F);
Wb.set("style",{ya:4});
The GTM Script is copied and pasted from the GTM-Admin without any change made to it and is included in the header.php file of the Wordpress template. I tried copying it again and replacing the script that was in the header.php previously but the result was the same.
If looking at the actual error message in the console helps, the issue can be seen on the following URL:
https://www.bindella.ch
Any help in solving this or at least pointer to where to go look for errors would be very much appreciated.
Thanks
Very interesting, and yes, you're right, the error in the minified code makes no sense:
Let's try something different. First, just export your GTM container (the workspace that is synced with prod/live) as a JSON file in Admin section.
Open the file, look for something like set("style" See if you can find that Wb. Well, don't expect it to be Wb. I guess GTM minifies the code. It may be some weird chat bot, or something like that. From there, you'll be able to find the tag or variable that causes the issue.
I didn't look too deep into it, but that part of code looks sophisticated enough to be a part of the core container code. Actually, we can check it right here, on SO cuz it uses GTM too, let's do that.
Yes, SO has identical code. Looks like it's indeed core GTM. Well, there's a tiny probability that when you built the prod library last time, GTM had an issue and it deployed an artefact.
Try making a new workspace, make a nonsensical change in it and publish it to production. See if it lets you publish. Then see if that fixes the issue.
Now, if it doesn't then the next thing I'd try is trying to re-importing the exported JSON, forcing GTM compare the import to what's there and find differences.
Now if that shows no issues, then I would make a brand new container, load the config in it and try replacing the gtm loading script to see if the error still happens. It sounds like you can do that. If you can't, look a plugin like redirector to redirect the request to a different container.
Still the error with the new container? How about if you load a completely empty container? Got any errors?
There's a very slim chance that your front-end deploys one of a few vars GTM uses too, thus conflicting with your GTM. But it's very unlikely. Why would you use something like google_tag_manager or google_tag_data in the global scope...
If nothing helps and only the empty container doesn't give errors, then... well, then make a list of all tags firing along that error and start disabling them one by one. Or use breakpoints to narrow it down to the tag/library that causes it.

"_.debounce is not a function" when using lodash 4.11.1

I'm completely new to lodash, but I'm trying to implement debounce as per this article. I can get it using v3.5 via this CDN but every time I try to download 4.11.1 and include it in my project I get an Uncaught Type Error: _.debounce is not a function.
Here's my script, pretty straightforward:
jQuery(window).on("resize", _.debounce(function() {
console.log("hello world");
}, 400));
Any ideas why this wouldn't be working with the newer version of lodash? I referenced the documentation and I'm not seeing anything out of place here. Very odd.
Okay, I feel dumb about this. I completely missed that there where two separate builds, "core" and "full." Apparently core doesn't come bundled with debounce. I've got it working now with the full script.

Wikitude SDK project derived from samples doesn't work

I've been modifying the sample projects Wikitude SDK provides, and I'm facing a problem: it seems like this code never works:
this.tracker = new AR.Tracker("/assets/magazine.wtc", {
onLoaded: this.worldLoaded
});
That is, the world never loads, so the function "worldLoaded" is never called.
I have no idea why the world doesn't load as the file is the original provided in the samples and it used to work.
The difference seems to be trivial, I only added a new member to the World variable that would define some additional parameteres.
The error I get is
Uncaught TypeError: Cannot read property 'apply' of undefined
ade.js:1AR.i.__executeFunctionByName ade.js:1AR.i.callAsync ade.js:1l
Any idea how to tackle this?
It seems as if you have the ADE activated, which is not necessary on a mobile device. In your HTML, please delete the line (your path to ade.js might differ slightly). This will make the error go away.
In addition, my suggestion is to also add an onError event to the tracker. In this case, you'll be notified when the tracker cannot be loaded (wrong location specified, invalid file etc), and you can react accordingly.

Javascript Error: Function is not Defined when called through onclick

I've been attempting to write a basic website for a school project, and have decided to create it using a hybrid of html and basic javascript. Currently, I have the following html code for part of the site:
HTML Code
With the javascript "ScriptWindow.js", called in line 6 as:
Javascript "ScriptWindow.js"
The main issue I have seems to be lines 11-15, where I attempt to call the javascript functions GetNext(), GetPrev(), etc. My Google Chrome developer tools tell me that the error on the site is "Uncaught ReferenceError: GetNext is not defined ", even though I thought I had defined it in the javascript file perfectly clear.
I've tried putting the javascript file through a bug tested, and there seems to be no error that I or it can find, which leads me to the presumption that the javascript file is not being properly called. I've tried pasting the javascript directly into the html code, but it still doesn't recognize that the functions are there.
This leads me to believe that it's some issue with how the onclick tries to find the javascript function, or that somehow I have placed the javascript in the wrong spot or perhaps it is not loading in time for the button to find it. I've tried moving the line where I reference the javascript to different places: At the end of the body section, before the body section, with the other two javascript declarations at the very beginning, but nothing seems to work.
If anyone could shed a little light on my issue, it would be wonderful. I am completely new to javascript, so I realize that there's probably a silly mistake (Or a big one) that I'm overlooking. Thanks for your time.

Socket.io failed to load websocket.js

I tried to use socket.io in an simple app.
When it is calling the following js file:
node_modules\socket.io\lib\transports\websocket.js
The following line failed to load (It didn't really fail. It actually returned some empty result and failed some later codes using protocolVersions):
var protocolVersions = require('./websocket');
I debugged a little bit and it seems that the intention of this line is to load the following js file:
node_modules\socket.io\lib\transports\websocket\index.js
However because there is also a "websocket.js" (the file being run) under the "transports" folder, the require functions always tries to load "websocket.js" instead, and return some unexpected results.
I changed the folder name to "websockets" and call "require('./websockets')" instead, and it fixed the problem. However this is a shared library I am not feeling comfortable messing up its codes.
I am trying to understand why this problem happened this way and what should be the best way to work around it. I am sure this piece of codes has been well tested before released.
You probably already noticed that I am using backslash '\' to separate the path. Yes I am running it on Windows! Will that create any difference?
Thanks!

Categories

Resources