I have a Top Down Tank project that I have been working on , it is coming along well but I am a little stumped on how to make rules for when I deploy a stationary unit.
what I have is a stationary turret , right now it is set up that I can build the unit , and it is represented in a deploy button when I click the button the unit is instanced and will follow the mouse pointer when I left click again it is dropped in place, if I hold the mouse button I can drag to rotate, it works great except for two little problems , one I can fix by either disabling the turret or making a dummy unit so it cant shoot and target while on the mouse pointer. the other problem is the one I don't have a solution for , I can drop the turret anywhere , the problem there is that I can drop it inside of walls or the HQ building or a tank. it is a static-body and during placement it is moved by directly animating the global position the position is just set to be equal to the global mouse position, and bodies don't register collisions moving that way.
the functionality for making that work was built into a control script that does things like find the map limits , move the camera by mouse pointer close to the view-port edge and box/click select, I have all controls still limited to the mouse pointer and left click so the turret is placed and rotated in { _input(event) } and I dont really see how move and collide would work with the idea of dropping the unit that way anyways.
so I am looking for some suggestions as to how I could tackle that and make it so the player cant drop stationary units in places that are already occupied.