1
Support / Re: Collision for Sprites/Tilemaps
« on: January 08, 2014, 07:52:08 pm »
That seems to be the issue and why none of my collisions were working. Thanks again for your help.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
public class PlayerScript : MonoBehaviour {
// Use this for initialization
void Start () {
Debug.Log("started");
}
// Update is called once per frame
void FixedUpdate () {
rigidbody.MovePosition(rigidbody.position + new Vector3(-10f * Time.deltaTime, 0, 0));
}
void OnCollisionEnter(Collision collision)
{
Debug.Log("collision entered");
GameObject.Destroy(this);
}
void OnTriggerEnter (Collider other) {
Debug.Log("trigger entered");
GameObject.Destroy(this);
}
}
public class PlayerScript : MonoBehaviour {
// Use this for initialization
void Start () {
Debug.Log("started");
}
// Update is called once per frame
void Update () {
transform.Translate(-10f * Time.deltaTime, 0, 0);
}
void OnCollisionEnter(Collision collision)
{
Debug.Log("collision entered");
GameObject.Destroy(this);
}
void OnTriggerEnter (Collider other) {
Debug.Log("trigger entered");
GameObject.Destroy(this);
}
}