Sprite do not collide with another sprite (Even with collider and Rigidbody) [2D]
Hello everyone,
Little problem here, basically I have an ennemi which chase the player when he's too close.
The ennemi is chasing me and collide with the player so there is no problem here, but my problem is the next one: My ennemi do not collide with 2D sprite with box collider (with or without Rigidbody Kinematic, I tried both) but My Player collide with the 2D Sprite.
So the problem probably come from the ennemi script, here is the part I'm using to make the ennemi chase my player:
function chase (){
var step = moveSpeed * Time.deltaTime;
GetComponent.<Rigidbody2D>().position = Vector2.MoveTowards(transform.position, Target.position, step);
}
// The "target" in the script is the player
Before these lines I was moving the ennemi by his Transform component so I came with the idea that it will work by moving the Rigidbody instead of the Transform but it's still not working, any ideas guys ? Thanks !
Answer by YetiStudio · Mar 16, 2016 at 09:04 AM
Ok I fixed it ! I just disabled "isKinematic" and I went to: Project settings -> Physics2D -> put Y to 0 and everything is ok ! The sprite was falling over and over when isKinematic was disabled cause of the 2D Gravity.