- Home /
Question by
Aquarii_Z · Apr 29, 2021 at 05:43 PM ·
2draycasthit2dlinecastobject referenceroguelike
Using methods from other classes on a linecast hit
I have a 2D Game where you can mine blocks, there was a problem where you could mine through blocks, and I want to make it so you can only mine the blocks that are immediately exposed to you, so I did a linecast which goes from the player to the the mouse that stops at the hit.point if it detects a collision, however once I detect this collision I can only really delete the block, I want to call a method from the block script which will decrement the blocks hp and be deleted once hp < 0, but I cant call it on the instance of the block that the linecast is hitting, any fixes?
Comment