Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Third Person Melee Attack

$
0
0
I have javascript for first person melee attack, but it does not works on third person, can any body help me out with it, i need it working on third person. the code is just for calculating the distance but it doesnt work on third person: var TheDamage: int = 50; var Distance: float; function Update() { if (Input.GetButtonDown("Fire1")) { var hit: RaycastHit; if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit)) { Distance = hit.distance; hit.transform.SendMessage("ApplyDamage", TheDamage, SendMessageOptions.DontRequireReceiver); } } }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



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