2
\$\begingroup\$

The question is just a logical extension of this question.

So, how should I render a cylindrical world space onto a flat, 2D view port in Unity?

Thank you.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The coordinates of any point on a cylinder can be expressed as (r, θ, z), where r is the constant radius of the cylinder, θ is the angle around the z-axis and z is the "height" of the point. You can convert that into 2D coordinates by throwing out r, treating θ as x and z as y.

Keep in mind that θ will be between 0 and 2π (or 0 and 360), so you'll need to scale that the appropriate width to look reasonable when projected onto the x coordinate. You'll also need to deal with the wraparound mathematically, probably by using the modulus operator. This blog post may be useful in coming up with ideas for how to deal with such edge cases.

You probably don't have cylindrical assets, but instead have 2D assets. As such, you should just be able to use them like you would any other 2D asset in Unity.

\$\endgroup\$
3
  • \$\begingroup\$ Will such an approach preserve the standard Unity 2D physic or will I have to write the 2D physics from scratch? Thank you. \$\endgroup\$ Commented Feb 1, 2019 at 21:06
  • \$\begingroup\$ I would think it would work. I don't know much about Unity myself, though. I don't see why it wouldn't work. \$\endgroup\$ Commented Feb 2, 2019 at 2:37
  • \$\begingroup\$ I just can not imagine how I would use a 2D Sprite Renderer on the cylinder. Thank you. \$\endgroup\$ Commented Feb 3, 2019 at 21:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .