[ENGINE_ONLY] JS Error

Hi, I am setings up my Vue app. I got this error, do you know something?

I assume it has something todo with the Ammo.js

I use Version: Powered by PlayCanvas 1.35.1 3317bcfb

From the logs I don’t see anything that would point to Ammo.js. Unfortunately, I am not familiar with Vue, but I would start from looking into your PlayCanvas.vue, line 136.

2 Likes

@LeXXik thanks a lot, works now, my fault.

1 Like

Guys, at what time in the “App LifeCycle” the scripts, e.g. cameraScripts, etc should be added.
I got those Warnings, but the scripts work anyway as they are added by Vue Mixins, probably this is not the right place, as there are several methods during initialization as app.configure, app.preload, app.loadScene, … Do you have a tip?

scripts

It looks like you are adding the pc.script to an entity before they have been created/loaded.

Basically, you need to create/load the pc.scripts before using them. It doesn’t really matter when as long as that condition is met.

Also, make sure “lookCamera” is the script name under which you are registering it. If you later change the name, but keep adding it to the entity under its old name, you will get that warning.

Thanks for the hints, it seems that also this setting is influencing it:
pc.script.legacy = false;

Sorry to bother you again, something went wrong with script laoding, scripts are
working only on “hard reload CTRl + F5” When switching routes not :frowning:

From what script is this.fireRaycast() from PlayCanvas or Ammo?

BoxPlacement.prototype.onMouseDown = function (e) {
console.log(‘MD’, this);
this.fireRaycast(e);
};

Neither, that would be calling a function on that pc.script (BoxPlacement).

Ups, right, silly me, should better look :slight_smile:

How do I achieve to load attributes to scripts using engine and not the json?

 "scripts": {
                        "boxPlacement": {
                            "enabled": true,
                            "attributes": {
                                "boxEntity": "3f832022-abc1-11e6-8e09-22000ac481df",
                                "cameraEntity": "3f831c9e-abc1-11e6-8e09-22000ac481df"
                            }
                        }
                    }

See ’ Adding a script component at run time’
https://developer.playcanvas.com/en/user-manual/scripting/creating-new/

1 Like