I have errors with Ammo but I don't use Ammo in cart script

I have errors with Ammo
but don’t know why
here is the script

/*jshint esversion: 6 */

class Cart extends pc.ScriptType {



        const keyboard = pc.app.keyboard;
        const left = keyboard.isPressed(pc.KEY_LEFT);
        const right = keyboard.isPressed(pc.KEY_RIGHT);
        const up = keyboard.isPressed(pc.KEY_UP);
        const down = keyboard.isPressed(pc.KEY_DOWN);

        let x = 0;

        const cartPos = this.entity.getPosition();
        if(left && cartPos.x > -5){
            this.entity.translate(1, 0, 0);

        if(right && cartPos.x < 5){
            this.entity.translate(-1, 0, 0);

pc.registerScript(Cart, 'cart');

Hi @grzesiekmq,

Can you post the exact error you get?

Uncaught RangeError: Maximum call stack size exceeded

Uncaught RuntimeError: memory access out of bounds

maybe I just should turn off the collision and rigidbody

So that means your physics sim reached the limit Ammo allocates. That means you have either too many bodies or, what is a common issue, you tried to use a Mesh collider that has too many polygons.

1 Like

turning off the collision and rigidbody helped

1 Like