I’ve recently started working with Unity on a 2D project, a little simple game to help get to grips with the basics, I’ve done a few tutorials (Infinite runner and the rogue like). Now i’m working on a simple game side view game that allows the player to “dig” downwards with certain blocks earning points.
I have the world generation working for a first test, with a grid of blocks using 2DboxCollider and a simple tile sprite, and i have the “dig” functionality working using a raycaster to destroy the block the mouse is facing towards, this is where my problem shows up, When the player clicks to “dig” the raycaster checks for the collsion and if it finds one, checks the tag (i’m not sure if this is the best way) to ensure it’s a “diggale” block and then calls the “OnHit” method of the script attached to that block, this script simply calls gameObject.SetActive(false).
The block vanishes as expected, however the player cannot move into the space the was occupied by that block without first moving away and then back towards the block. I’m not sure why this is?
Also, my player get’s stuck on the side of block while jumping, I have a feeling this is because i apply a force in the direction the player is pressing, and that force is enough to counteract the gravity by pushing the player against the side of the block, what would be the best way to avoid this?
I hope I’ve explained things well enough, and thanks for any help you can provide.