Sphere entering in to the cube.unity
Posted
by
Parthi
on Game Development
See other posts from Game Development
or by Parthi
Published on 2013-10-26T14:24:17Z
Indexed on
2013/10/26
16:10 UTC
Read the original article
Hit count: 243835
unity
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);
}
}
}
© Game Development or respective owner