https://playcanvas.com/editor/code/559260?tabs=12921480,12934103
thx you if you help i will reply to you back
https://playcanvas.com/editor/code/559260?tabs=12921480,12934103
thx you if you help i will reply to you back
I would create a script titled: boxMove
and place the following in the update function only…
var speed = 5;
//Moves the object with Left Arrow Key
if (this.app.keyboard.isPressed(pc.KEY_LEFT)) {
this.entity.translate(speed*dt, 0, 0);
}
//Moves the object with Right Arrow Key
else if (this.app.keyboard.isPressed(pc.KEY_RIGHT)) {
this.entity.translate(-speed*dt, 0, 0);
}
//Moves the object with Up Arrow Key
else if (this.app.keyboard.isPressed(pc.KEY_UP)){
this.entity.translate(0, 0, speed*dt);
}
//Moves the object with Down Arrow Key
else if (this.app.keyboard.isPressed(pc.KEY_DOWN)){
this.entity.translate(0, 0,-speed*dt);
}