Quantcast
Channel: Questions in topic: "write-my-code"
Viewing all articles
Browse latest Browse all 92

Melee Attack

$
0
0
I'm trying to make a melee attack so I put rigidbodies(iskinematic) to object and sword. I also added coliders but the problem is sword may touch the collider when the character moves a bit without waiting my hit command. What can i add to my code to wait for the animation to finish? Here is my code: using UnityEngine; using System.Collections; public class Health : MonoBehaviour { public float health; void Start() { health = 100; } void Update () { if (health < 0) { Destroy(this.gameObject); } } void OnTriggerEnter(Collider other) { if (other.tag == "Weapon") { health -= 10; } } }

Viewing all articles
Browse latest Browse all 92

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>