Question by
lonelycamper · Apr 01, 2018 at 06:30 PM ·
unity 5damage
Rocket splash Damage
I'm generally wondering how would I go about making splash damage
I have a script here that calculates splash damage: private void RayCastShoot() { Ray ray = cam.ScreenPointToRay(new Vector2(Screen.width / 2, Screen.height / 2));
if (Physics.Raycast(ray, out hitInfo))
{
//RocketLauncherObj.LookAt(hitInfo.transform);
var tempexpEffect = Instantiate(explosionEffect, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));
Destroy(tempexpEffect, 1);
Destroy(tempProjectile);
proximity = (hitInfo.point - hitInfo.collider.transform.position).magnitude;
Splashdamage = CritHitDamage - (proximity / splashRadius);
}
But that composes a problem I only want it to calculate the damage if the radius hits the "Player tag" I tried adding if hit.info collider is == player etc.. and it only calculates it if i actually hit the player
Comment
Your answer
Follow this Question
Related Questions
How to Draw Particles Between UI Sprite and UI Sprite? 1 Answer
Activating Room upon Entry 0 Answers
How to disable mouse look in Unity 5? 2 Answers
Switching player controllers 0 Answers