hi,
I am working on a pokemon clone, just to gain some expirience...
So I am using the tilemap from 2d toolkit.
I want to check if a player can move before he moves.
I have set it up like this:
1 main layer in tilemap. No collision.
1 border layer. with a unity layer named collision.
default physics is set on 2D.
in my code is cast a ray to see if the ray hits layer collision like this:
public LayerMask GroundLayer; //ground layer is set to collision
else if (Input.GetKey(KeyCode.DownArrow) && isMoving == false)
{
bool disableMove = false;
if (Physics2D.Raycast(transform.position, -Vector2.up, 1, GroundLayer))
{
disableMove = true;
}
else
{
Debug.Log("nothing");
}
if (!disableMove)
{
increment = 0;
isMoving = true;
startPoint = transform.position;
endPoint = new Vector2(transform.position.x, transform.position.y - 1);
}
disableMove = false;
}
so I think the problem is that there are no colliders on my chuncks.
even tho I selected the littlebox with "colliders" when making the layer.
When I put a box collider around the chunk it will just create a giant square. And im locked in there.
I hope it's clear. if not ask me anything.