- Home /
Question by
xotickhan · Sep 04, 2013 at 10:38 AM ·
third-personmelee attack
Third Person Melee Attack
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);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Using a Key to Activate Camera Mouse Look 1 Answer
rolling ball is a child that needs to be steered by parent 1 Answer
Problem with mouse look and second skybox cam 0 Answers
Third Person Ladder Help! 1 Answer
How to use virtual Joystick.js (Mobile Assets) with the default ThirdPersonController? 3 Answers