- Home /
Question by
ferpa · Oct 05, 2014 at 09:17 PM ·
c#collision2d
Problem after collision2D ?
Hello
I'm having a problem that I don't know how can I solved.
In my game, I have some holes, when my player down on hole his return to first position.
After this is happen my player stay crazy, his lost position, animator, collisions, everything and I don't know how can I solve this problem and why it happens
look at problem in this video: https://www.youtube.com/watch?v=eH_vY4PhaJg
public class CanyonControl : MonoBehaviour {
public Transform player;
private Vector3 playerPosition;
// Use this for initialization
void Start () {
playerPosition = player.position;
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter2D(Collision2D coll){
if(coll.gameObject.name.Equals("PlayerObject")){
player.position = playerPosition;
}
}
}
Comment
Best Answer
Answer by ferpa · Oct 05, 2014 at 08:08 PM
Problem is solved. Instead pass Transform to script I did pass GameObject and now works (y)