Sphere entering in to the cube.unity
- by Parthi
I am trying Roll a Ball unity tutorial.Everything is fine,but when I roll the ball it is moving through the cube instead of picking it.
my player class is
using UnityEngine;
using System.Collections;
public class player : MonoBehaviour {
public float speed;
// Use this for initialization
// Update is called once per frame
void Update () {
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
Vector3 move = new Vector3(h,0,v);
rigidbody.AddForce(move * speed * Time.deltaTime);
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Pick up")
{
other.gameObject.SetActive(false);
}
}
}