New answers tagged

1

The solution to this is to use a Coroutine that waits for the variable to be destroyed. This guarantees that it will be able to make the MeshCollider. Here is a piece of sample code that could be used to implement a similar solution. Vector3[] v3 IEnumerator Start(){ PolygonCollider2D polyCollider = this.gameObject.GetComponent<PolygonCollider2D>()...


1

I'm not sure filling sharedMesh.vertices will be enough to convert your PolygonCollider2D into a MeshCollider. From my (not long enough and too basic) tests, when you try to create a MeshCollider and only give it vertices it doesn't work. Your MeshCollider will need vertices but also triangles. After getting the polygon points you might have to compute all ...


2

error: y has private access in Polygon This simply means, that the y field is private in the Polygon class. Instead of trying to use balls1.y to reach that variable, use setPosition(float x, float y), getX() and getY()


0

I've been proposed for using awesome Clipper library. It is exactly the thing I need. "For constructing the union of 2D polygons you can use Clipper library."



Top 50 recent answers are included