curve objects in unity3d to wrap around an invisible cylinder?

curve objects in unity3d to wrap around an invisible cylinder?

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?

Solutions/Answers:

Answer 1:

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.

References