Quantcast
Channel: Questions in topic: "collider 2d"
Viewing all articles
Browse latest Browse all 148

How do I find the two vertices of a collided edge on a PolygonCollider2D?

$
0
0
Hey guys, I'm currently working on some destructible terrain for a 2D game, and I'm trying to make a relatively low-cost way to deform my polygon colliders. At present, I'm using a raycast as a bullet towards the terrain. I want to add the point of impact as a vertex to the collided PolygonCollider2d. The problem with this so far is that I can't find a way to put the new vertex in the right spot on the collider. Does anybody know of a way that I can find the two vertices that make up an impacted edge? I can't just go through the array of points of the collider and find the nearest two points; there are a lot of cases where that will get the wrong two points. Thanks everyone in advance.

Viewing all articles
Browse latest Browse all 148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>