4
\$\begingroup\$

Is there a way to transform objects in unity3d so that they can become curved? Imagine that I wanted to create a rectangle that wraps around an invisible cylinder, or that I wanted take a sprite image and roll it up like a roll of paper. Do you know how this would be done?

\$\endgroup\$
  • \$\begingroup\$ You can see some mesh manipulation stuff here \$\endgroup\$ – MichaelHouse Jun 11 '14 at 21:31
  • \$\begingroup\$ There is a brilliant sample which does exactly this here. It curves a plane, preserving the UVs, and has properties for segments/radius/degrees etc.. \$\endgroup\$ – Jethro Aug 20 '18 at 12:41
1
\$\begingroup\$

Yes, this can be done. There's nothing built into Unity that will do this, but you can modify the plane mesh that displays your image.

For this you'll need to access the mesh vertices. Deforming you mesh to a cylinder is the process of moving all the vertices of the mesh so their new position gives the mesh a different shape. In this case, a cylinder. There's a few strategies for moving the vertices to look like a cylinder, you can find a few here. As I suggest there, mapping your cartesian coordinates to cylindrical coordinates is a pretty simple way of doing things. A similar example can be seen here, except with spherical coordinates.

You can see that it's not a simple process, but it's certainly possible.

An alternative strategy would be to create a mesh in an external application, then create an animation of the mesh rolling up, likely with a number of bone transformations. Then you can simply play that animation in Unity, with your sprite mapped as the texture. If you need more information about creating that kind of animation, ask on the appropriate forum for the 3D modeling application you're using. You might try Blender along with the Blender SE.

| improve this answer | |
\$\endgroup\$

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.