Quantcast
Channel: Questions in topic: "tagging"
Viewing all articles
Browse latest Browse all 120

Usage of multiple tags or some other workaround?

$
0
0
I've a projectile that I want to work for two tags "Enemy" and "Player" but after a bit of Google search: it doesn't seem like there is a way to tag them both (unless I'm mistaken?) but in that case, then how would I go about changing this part of the script, so that the projectile works on both the enemies and the player, when they are getting shot at? void OnCollisionEnter (Collision collisionTemp) { if(collisionTemp.gameObject.tag == "Enemy") { collisionTemp.gameObject.SendMessage("TakeDamage", damage, SendMessageOptions.DontRequireReceiver); ContactPoint contact = collisionTemp.contacts[0]; Quaternion rot = Quaternion.FromToRotation(Vector3.up, contact.normal); Vector3 pos = contact.point; Instantiate (lasterHitFXPrefab, pos, rot); Destroy (gameObject); } }

Viewing all articles
Browse latest Browse all 120

Trending Articles



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