Rectangle intersection not workin
Using the code provided, I've tried the ways I knew to make the tripods remove once they're hit by a bullet. Yet the program does not even register the intersection in the debug console. I need to get the intersection of the bullet and the tripods to work.
4 Replies
$paste
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
I perhaps know the reason why it doesnt work
The code decided to stop updating when trying to implement new changes. I tried to remove some of the commands, but they fired nonetheless when I debugged.
there are couple of reasons on why your Rectangle.intersect may not work
for example if you're linearly interpolating them, make sure the result of your
speed * t * delta
on your interpolator /lerp won't surpass the width / height of the target rectangle you're colliding with
think of it similar to frame-skipping
Intersect/contains on a Rectangle is just regular method that checks if they're overlapping on static objects(mostly) and they don't do any raycast ahead of them so that's why they can fail in lotta scenarios
that said, avoid using intersect/overlap on Rects unless they're static objects.