Hey guys,
I’m new at this so I started with the tutorial: Roll-a-ball. I’m now at section 3.02.
I made the script to trigger the pick ups. I can roll the ball (player) put I cant pick up the cubes.
The ball just rolls through to the cubes and they don’t disappear. I got the tag for the cubes copied from the script so I know for sure that the tag is good. I hope you can help me.
public class PlayerControler : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
public class ExampleClass : MonoBehaviour
{
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Pick Up"))
other.gameObject.SetActive(false);
}
}
}