with the performance tool, I noticed that my character animation causes the long script times:
MoveWalk.prototype.update = function(dt) {
Walkstep = Walkstep +1;
if(Walkstep == 1){
this.entity.parent.parent.findByName('MoveFLL').enabled = true;
this.entity.parent.parent.findByName('MoveFLLKnee').enabled = true;
this.entity.parent.parent.findByName('MoveHLR').enabled = true;
this.entity.parent.parent.findByName('MoveHLRKnee').enabled = true;
}
if(Walkstep == 10){
this.entity.parent.parent.findByName('MoveFLR').enabled = true;
this.entity.parent.parent.findByName('MoveFLRKnee').enabled = true;
this.entity.parent.parent.findByName('MoveHLL').enabled = true;
this.entity.parent.parent.findByName('MoveHLLKnee').enabled = true;
}
if(Walkstep == 20){
Walkstep = 0;
if(this.app.root.findByName('rootWorld')){
this.app.root.findByName('rootAction').findByName('CameraMenue').findByName('CameraHerbi1').findByName('CamHerbi1On').script.herbi1CamMove.setCamera(3);
}
}
this.walk();
};
MoveWalk.prototype.walk = function (){
WalkSpeed = this.entity.parent.parent.script.herbiBuild.Speed;
if(this.app.root.findByName('rootAction')){
if(this.app.root.findByName('rootAction').findByName('Property').findByName('activePotion').findByName('SpeedPotion').enabled){
WalkSpeed = WalkSpeed + 10;
}
}
if(this.app.root.findByName('Herbis')){
if(this.app.root.findByName('Herbis').findByName('Herbivore').findByTag('Rollerskates')[0].enabled){
WalkSpeed = WalkSpeed + 25;
}
if(this.app.root.findByName('Herbis').findByName('Herbivore').findByTag('Skateboard')[0].enabled){
WalkSpeed = WalkSpeed * 35;
}
}
WalkMass = this.entity.parent.parent.rigidbody.mass;
WalkSpeed = 35 + (WalkMass * WalkSpeed / 10);
if(this.app.root.findByName('rootWorld')){
this.app.root.findByName('Core').rotateLocal(0,0,-WalkSpeed/100);
}
Vector0 = new pc.Vec3(0,0,0);
Vector1 = this.entity.parent.parent.findByName('Body').findByName('Torso').findByName('Head').findByName('NeckAnkle').findByName('NeckAnkle2').findByName('Skull').findByName('Skull2').findByName('Vector1').getPosition();
Vector2 = this.entity.parent.parent.findByName('Body').findByName('Torso').findByName('Head').findByName('NeckAnkle').findByName('NeckAnkle2').findByName('Skull').findByName('Skull2').findByName('Vector2').getPosition();
Vector0.sub2(Vector2,Vector1);
Vector0.normalize();
Vector0.scale(WalkSpeed);
//alert(Vector0);
this.entity.parent.parent.rigidbody.applyForce(Vector0);
};
these calls function like this:
HeadTurnLeft.prototype.update = function(dt) {
if(MoveFor17 < 15){
this.entity.parent.parent.findByName('Body').findByName('Torso').findByName('Head').rotateLocal (0.5,0,0);
MoveFor17 = MoveFor17 +1;
} else {
if(Toogle17){
MoveBack17 = 15;
Toogle17 = false;
}
}
if(MoveBack17>1){
this.entity.parent.parent.findByName('Body').findByName('Torso').findByName('Head').rotateLocal (-0.5,0,0);
MoveBack17 = MoveBack17 -1;
}
if(MoveBack17==1){
MoveFor17 = 1;
MoveBack17 = 0;
Toogle17 = true;
this.entity.enabled = false;
}
};
what should I do 