I want my projectile to knocked down the objects it hits (rigid body vs rigid body) and disappear right after doing that. The only way I can detect a collision via script is by assigning a trigger. The problem is that once I assign a trigger to the projectile it just disappears when touching the object it supposed to knock down without affecting it.
Why do you have to use a trigger? Both objects should have colliders that AREN’T triggers, then just use the OnCollisionEnter function on your bullet.
you should use the collision methods
void OnCollisionEnter(Collision myCollisionInfo)
{
}
you just need to make sure you have Collider attached to the gameobjects you are going to collide
Thanks for the help!
I’m using:
void OnCollisonEnter(Collision collision)
{
Destroy(gameObject);
}
And nothing happens, so obviously I’m doing something derpy… :-/
I managed to get this working immediately after posting so I’ll paste it here
using UnityEngine;
using System.Collections;
public class ColliderScript : MonoBehaviour
{
void OnCollisionEnter(Collision other)
{
if (other.gameObject.tag == "Enemy")
{
Destroy(other.gameObject);
}
}
}