Basically i want my projectile to mark the map if its tagged as LevelParts but the problem is that the projectile isnt even detecting the tags on the level. A raycast version works perfectly but this one does not.
The code is obviously detecting collisions but not correctly. What have i done wrong?
function OnCollisionEnter(collision : Collision)
{
for(var contact : ContactPoint in collision.contacts)
{
Debug.Log("This colliders tag is named: " + collision.contacts[0].thisCollider.transform.tag);
}
}
I have tried even changing “ollision.contacts[0].thisCollider.transform.tag” to “contact.thisCollider.tag” and other things.
If its any more help this is the actual piece of code i am actualy wanting this to work on.
function OnCollisionEnter (collision : Collision)
{
for (var contact : ContactPoint in collision.contacts)
{
if(decalHitWall && contact.thisCollider.tag == "LevelParts")
{
Instantiate(decalHitWall, contact.point + (contact.normal * floatInFrontOfWall), Quaternion.LookRotation(contact.normal));
Destroy(gameObject);
}
}
}