Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 OnEd0t · May 02, 2020 at 10:10 PM · meshdeformationbenddeformbending

Bend 3d object (Mesh) at Runtime

Hi, so I am making a game that will change some things based on the overall speed of the game and player charachter (don't want to get in to much datails) Though something that can help you picture what i am trying to achive is that this game is subway surfers style, if you've ever played it (which i doubt that you haven't).

One of the things that will change is the player path and it will change from this: alt text To something like this: ( Not the same scalling its just somthing i made quickly for the sake of demonstration like i dont want it to strech as much ) alt text Basiclly I want to bend the platform at runtime.

How in the world can I do that. AnyThing can help!!

annotation-2020-05-03-010030.png (28.4 kB)
annotation-2020-05-03-010047.png (49.4 kB)
Comment
Add comment · Show 1
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 icehex · May 03, 2020 at 01:58 AM 0
Share

https://docs.unity3d.com/ScriptReference/$$anonymous$$esh.html

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by OnEd0t · May 04, 2020 at 07:35 PM

So, After a week of searching an scouting the internet for an easy simple way to bend the damn mesh at Runtime, I finally found an answer, But not something that I Personally would enjoy making. Simply you CAN do it, but:

You would have to create the mesh yourself in unity itself, as in assign all the vertecies and triangles and have to work all of that in vectors. it sounds more complicated than it actually is, but this is way to much for what I want to achive + I've givin up on the idea of having a bent mesh in the game.

Still if you have a way post it here in the thread or somewhere on the internet, so that somebody else can find the answer more easily.

Pretty lame answer but sorry, that's what I have.

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 icehex · May 05, 2020 at 06:33 PM 0
Share

The link I posted to your question shows you the Unity functions and example on how to create a new or edit an existing mesh. A mesh is just a set of points that describe an object. Triangles are logical groupings of those mesh points to tell the graphics renderer where to paint. A triangle's 'normal' is the side of the triangle that will be painted, the other side will not and would be see-through. The physics engine uses the meshes to find collisions, which is how your player would be able to walk on the mesh. Each point on the mesh is defined by its local x, y, and z coordinates. Local coordinates are ones where (0, 0, 0) is the center of your mesh when you build it in, for example, Blender, and import to Unity. For mesh editing, if you load a mesh, the points are referred to as vertices. You can cycle through each 'vertice' and change the x, y, and z location any way you want. If you had a mesh of a plank, and wanted to bend it, you could write some code to:

  • 1) find the left-most and right-most vertices on the plank

  • 2) calculate the distance between those two vertices, then divide by two

  • 3) iterate through each vertice and change its Y coordinate proportionally to the value you got from 2). Write the equation such that the larger the difference between the vertice's X coordinate and the value from 2), the larger deflection you apply to the Y coordinate of that vertice.

Singular for vertices is vertex. Also be $$anonymous$$dful of which dimension in your local mesh corresponds to X, Y, and Z.

avatar image
1

Answer by Bunny83 · May 03, 2020 at 10:31 AM

You mean something like this:

How to make plane look curved?

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 OnEd0t · May 03, 2020 at 11:44 AM 0
Share

I mean... i have thought of making it an illusion, but i don't think that it work for my use here since A) i am not bending on the Z Axis I am bending on the X Axis and an illusion won't work simply because i am bending quite a lot actually, see the main game character isn't a human, its a space ship and ins$$anonymous$$d of flying linearly or like in a straight line across the X Axis, the path will start curving (in a parabolic shape cuz the ship can already fly across a parabola) based on the speed of the ship and the overall game, so as it gets faster the path will start curving, and when i say curving, it means A lot of curving and an illousion isn't going to cut it. B) I am bending for the sake of making the game harder in diffeculity not for looks or aesthetics (hence the extreme bend)

I just want to bend the mesh in runtime

though if its the only option i guess i'll have to start learing everything about shaders.

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

141 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 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

Mesh deformation/wobbling 1 Answer

2D Mesh Deformation? 0 Answers

Cannot update meshcollider mesh? 1 Answer

Mash Manipulation like in real world? 0 Answers

Raycast on mesh deformed by shader 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