What is wrong with this code

if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
    var templateAsset = this.app.assets.find(“PlayerLaser”);
    var instance = templateAsset.resource.instantiate();
    var position = this.entity.getPosition();

    var entity = new pc.Entity();
    this.app.root.addChild(entity);

    entity.translate(position.x-2, position.y, position.z);
    entity.addChild(instance);   
}


Hi @Braxton_Payne and welcome!

The code looks correct to me, but I am not sure about using translate here.

What problem are you running into?