Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Kiloblargh · Oct 18, 2012 at 04:23 PM · terrainmeshdynamiclocalfaster

Can I move just some of the verts on a mesh?

I would say "terrain," but I don't think I want to use Unity's built-in Terrains for this. What I am trying to avoid is setting every single vertex's position every single frame when there are only a handful of them that are actually being moved. I think being able to do this is make-or-break for the feasibility of a new game concept I'm kicking around.

I think I should have an array (dictionary) of vertex numbers vs world space x-z coords. Then another of vertex numbers vs an array of all the numbers of that vertex's closest neighbors. (Which is probably harder to calculate than it is to say.) Am I on the right track though?

The procedural examples all iterate through every vertex in a temporary array and then set the mesh's vertex positions (or colors) all at once. Is there some reason why you "have to" do it like that?

Comment
Add comment · Show 3
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 flaviusxvii · Oct 18, 2012 at 04:27 PM 0
Share

Are yous using this mesh for physics as well (ala $$anonymous$$eshCollider)?

avatar image Kiloblargh · Oct 18, 2012 at 04:35 PM 0
Share

I'm not using it for anything yet, it's just in my head. But I'm going to say no, I don't want there to be a mesh collider.

avatar image Fattie · Oct 18, 2012 at 04:36 PM 1
Share

of course you can ! go for it. are you already familiar with manipulating mesh in realtime ? if not expect a learning curve of a few months

as Eric pointed out recently - I can't find the damn question - it's critical to note that it is very slow to update a mesh collider, you can't do it in real time, so forget that if that's your plan.

(other alternatives for you could just be selecting from a random selection of 50 or whatever surfaces, depending on your game?)

may be relevant ..

http://answers.unity3d.com/questions/315059/how-to-improve-performance-while-generating-extrud.html

you mention vertex neighbors in passing .. note ...

http://answers.unity3d.com/questions/193695/in-unity-is-there-a-fast-way-to-find-nearby-triang.html

you mention "The procedural examples.." I find them all to be not very good really! heh! i'd kinda recommend just completely ignoring them

1 Reply

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

Answer by Eric5h5 · Oct 18, 2012 at 04:45 PM

You must update every vertex in a mesh even if you only are changing a few. However, you don't need a temporary array. You can use a permanent Vector3 array for the vertices, and only change the relevant entries, but doing "mesh.vertices = myVertices" copies the entire array to the mesh, and is the only way of updating meshes.

Comment
Add comment · Show 2 · 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 Kiloblargh · Oct 18, 2012 at 05:06 PM 0
Share

Ok; that's what I was thinking. I guess I can test it myself, but is doing that every frame a big framerate hit and is "mesh.vertices = myVertices" expensive in direct proportion to the number of vertices being copied? (If so might just say "#$@*% it, I'm going voxels.")

avatar image Eric5h5 · Oct 18, 2012 at 09:34 PM 0
Share

is doing that every frame a big framerate hit

Depends on the size and number of the meshes, and how fast the hardware is.

is "mesh.vertices = myVertices" expensive in direct proportion to the number of vertices being copied?

Yes.

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

13 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

Related Questions

Can a dynamic mesh be made NOT readable? to save mem 1 Answer

Rivers on procedurally terrain 0 Answers

Very Very Big Terrain, how to show it? 1 Answer

Disable Culling for Terrain 0 Answers

Terrain heightmap isn't smooth 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