Hi, I currently have collision set up to have it so that is anything collides with my collectable object then the player gains points. This can be done by the character colliding or the projectile…obviously it isn’t very good if you can collect items by shooting your weapon at it.
Is there a way of telling the game that you only want the player character to be able to collide with the collectable and nothing else?
This is what I currently have, it’s very simple but it does the job for now…
using UnityEngine;
using System.Collections;
public class CollectableScript : MonoBehaviour {
public int pointsValue = 100;
public GameObject collectable;
public Transform collectablePos;
void OnTriggerEnter(Collider other)
{
Global.pointsEarned += pointsValue;
Destroy(gameObject);
}
}