Please this isnt working.
var Script = pc.createScript('script');
Script.attributes.add("slow",{type:"entity"});
Script.prototype.initialize = function() {
this.slow.element.on("mousedown",function(){
this.app.timeScale = 0.1;
}, this);
};
// update code called every frame
Script.prototype.update = function(dt) {
this.entity.translateLocal(0,0,-0.3);
this.entity.rotateLocal(0,30,0);
if(this.app.keyboard.wasPressed(pc.KEY_LEFT)){
this.app.timeScale = 0.1;
}
};
var Script = pc.createScript('script');
Script.attributes.add("slow",{type:"entity"});
Script.prototype.initialize = function() {
this.slow.element.on("mousedown",function(){
this.app.timeScale = 0.1;
}, this);
};
this is what doesnt work
Hi @jus.co_ding_me_23,
Could you expand on what you are trying to do?
Also if you can provide a sample project url to take a look that would help a lot.
yaustar
#4
This isn’t taking dt
(time) into consideration so changing timeScale won’t do anything.
Sounds like you want"
this.entity.translateLocal(0,0,-1 * dt);
this.entity.rotateLocal(0,100 * dt,0);