1
\$\begingroup\$

I'm trying to do a procedural 2D terrain generation. I've managed to make the function to generate the points, and I've been testing/debugging by creating the terrain using a 2D polygon collider on an object.

enter image description here

Now that it's done, I want to use this shape to crop a large sprite using the shape so that I obtain the shaped terrain. If I have a square terrain sprite, is there any way to crop the top or mask it to the shape of the polygon collider (or the shape of the function I'm using).

\$\endgroup\$
0
\$\begingroup\$

I think a sprite is a multipicture where you change the frame you want, it will have an alpha as part of the bitmap... the sprite class isnt really for inanimate ground images.

in unity, colliders i think should be part of a 2d mesh, mesh renderer, and you can apply the bitmap to the mesh.

\$\endgroup\$
  • \$\begingroup\$ The problem is that mesh colliders don't work 2D physics. :( \$\endgroup\$ – Pat Jan 25 '14 at 9:07
  • \$\begingroup\$ sounds like alot of web searching is necessary to follow other's efforts withe terrain creation in unity3d. many many have followed your path since u3d made 2d version of it's engine just recently. \$\endgroup\$ – com.prehensible Feb 6 '14 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.