- Home /
Question by
CGCxXSMALLSXx · Aug 25, 2013 at 01:13 AM ·
tree-creator
Chopping tree help???
It will play the Axe swing animation but when the ray hits the tree it does not play???
var KeyCooler : float = 1;
var ShootTimer : float = 1;
var KeyTimer : float = 1;
var ShootCooler : float = 1;
function Update (){
if( Axedamage.KeyTimer > 0){
Axedamage.KeyTimer -= Time.deltaTime;
}
if( Axedamage.KeyTimer < 0){
Axedamage.KeyTimer= 0;
}
if( Axedamage.ShootTimer > 0){
Axedamage.ShootTimer -= Time.deltaTime;
}
if( Axedamage.ShootTimer < 0){
Axedamage.ShootTimer = 0;
}
if( Axedamage.KeyTimer == 0){
if(Input.GetButtonUp("Fire1")){
animation.CrossFade("Axe swing");
if( Axedamage.ShootTimer == 0){
Axedamage.ShootTimer = Axedamage.ShootCooler;
Axedamage.KeyTimer = Axedamage.KeyCooler;
}
}else{
animation.CrossFade("Axe hover");
}
}
}
Comment
There's nothing here about a Ray, but try adding some Debug.Log stuff in your Ray() like debug.log("Ray hit: " + hit.transform.name); or similar to see if you are hitting what you think you should be