Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

I am trying really hard to avoid that and doing collision by hand comparing Vector distances,  but i think this wont take me far, i literally sort all boxes by distance and take the fist one,  

var boxesCandidates = boxes.Where(r =>
{
    if (r.id == _hoverBox.id) return false;
    var relativeY = r.startPosition.y - _hoverBox.startPosition.y;
    return verticalAxis > 0 ? relativeY > 0 : relativeY < 0;
});
boxesCandidates = SortByDistances(boxesCandidates, false);
var candidate = boxesCandidates.First();
SetHoverBox(candidate);

PD: Sorry for not been really helpful

Sorry, you've lost me at the code :)

If I understand it correctly from your first sentence, are you checking the distance between Obj A and Obj B and then seeing if the distance is less than their respective widths/heights?

If so, then how would you handle rotation? Maybe it'd be easier to just not do it and pretend everything is a sphere/circle so you'd just check in a radius around it?


Anyhow, that's an interesting approach; I think I'll stick with raycasts, even if they are more resource intensive, simply because they're easier, but do let me know how it work out!