Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by boxing_rex · Mar 29, 2017 at 07:43 PM · 2dmeshinterpolationprimitive

Unity 2D - Primitive Mesh Interpolation

Hi,

I am trying to figure out how I can smoothly interpolate between any 2D primitive at runtime, this is made harder by the fact that shapes can have different amounts of vertices, for example; I may want to smoothly switch between a Triangle and a Square, or Octagon.

My question is, what is the best way about doing this? my initial thoughts were to program this by defining the shapes in code and performing some morphing algorithm, but this would not account for the change in vertex count. My other idea was to use the Animator to somehow switch out the gameobject and blend the transition, but this seems an awful lot of work and makes for a very rigid system. It would also take a lot of time to implement new shapes.

Any thoughts and ideas are welcome. As are code snippets!

Thanks for your time.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Rhombuster · Mar 29, 2017 at 08:57 PM

This is an interesting question. You could try building the shapes yourself, then make them all have the same number of vertices. For example, your circle needs something like 28 vertices. Build a square with the same number, then interpolate each vertex from the circle to its appropriate vertex on the square.

This could get tricky, you'll have to make sure you rotate both objects. So if your circle has been rotated 45 degrees, you'll have to rotate the square 45 degrees then interpolate. The problem is creating the shapes could become tedious. It should work though, as long as you're careful.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image boxing_rex · Mar 29, 2017 at 09:22 PM 0
Share

Hi Rhombuster,

Thanks for your reply, I was thinking of a similar solution as performance wont be an issue with the small amount of vertices. The issue with this solution is that you have to map vertices from one shape to another, i guess if the vertices are in an ordered list and the object rotation is the same you can rely on the array index for vertex position mapping - assu$$anonymous$$g all of the vertices are initially declared in the same way (clockwise or anticlockwise).

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

106 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to flatten 3d image STL to 2d 0 Answers

Draw/generate shape as 2D sprite? 0 Answers

How to extend the curve created using quadratic interpolation? 0 Answers

How to generate a NavMesh only with colliders? 5 Answers

How to make 3D colliders on sprites? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges