I am news in Playcanvas.
I develop this small PlayCanvas | HTML5 Game Engine.
In this project box will be moved when press w or s.
My question is how can I detect box hit another object and can not pass through another box ?
Here is my code
var Script = pc.createScript(‘script’);
// initialize code called once per entity
Script.prototype.initialize = function() {this.app.keyboard.on(pc.EVENT_KEYDOWN, this.keyDown, this);
};
// update code called every frame
Script.prototype.update = function(dt) {};
Script.prototype.keyDown=function(e)
{if(e.key==pc.KEY_W) { this.entity.translate(-0.5,0,0); } if(e.key==pc.KEY_S) { this.entity.translate(0.5,0,0); }
};