Answers for "OverlapSphere not causing damage? - Solved"http://answers.unity.com/questions/507717/overlapsphere-not-causing-damage.html
The latest answers for the question "OverlapSphere not causing damage? - Solved"Answer by P2ThatGuyhttp://answers.unity.com/answers/508900/view.html
If anybody else is having a similar issue, I figured it out. Rather than a GetComponent, I put a function inside the ai script :
function Damage (dmg : int) {
health -= dmg;
}
then in the script I previously posted replaced the enemy tag bit with this :
if(hit.collider.gameObject.tag == "Enemy"){
hit.collider.gameObject.SendMessageUpwards("Damage", 110, SendMessageOptions.DontRequireReceiver);
hit.collider.gameObject.rigidbody.AddExplosionForce(force, explosionPos, radius, 3.0);
}
}
thanks for all help that was previously given.Tue, 06 Aug 2013 11:23:30 GMTP2ThatGuyAnswer by Jamorahttp://answers.unity.com/answers/507755/view.html
You are using <code>hit.transform.tag</code>, which won't work; only GameObjects have tags. So you need to replace that with <code>hit.gameObject.tag</code>
Same applies for the GetComponent below; use gameObject instead of transform.
Unless I missed something else (and assuming the rest of your code logic works) that should do it.Sun, 04 Aug 2013 19:36:56 GMTJamora