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 saberboy117 · Jun 19, 2013 at 11:00 PM · vertex

Manipulating a vertex on a plane

How can I go about getting/translating a vertex of of a plane/cube?

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 AmoralAckbar · Jun 21, 2013 at 03:29 PM 0
Share

I would appreciate some more information about what exactly you are trying to do with the information.

However, what you are likely going to want to do is get to the $$anonymous$$esh object that is available via the $$anonymous$$eshFilter component on your gameobject. Once you get the $$anonymous$$esh object, you can access the vertices, triangles, and uv arrays for the mesh and make modifications.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by vik.vega · Jun 21, 2013 at 03:41 PM

you need to access the vertices through the Mesh function this way

 function Update () {
     var mesh : Mesh = GetComponent(MeshFilter).mesh;
     var vertices : Vector3[] = mesh.vertices;
     var normals : Vector3[] = mesh.normals;
     for (var i = 0; i < vertices.Length; i++)
         vertices[i].transform.position = vertices[i].transform.position + Vector3(0,(Random.Range(-1,1),0)
     mesh.vertices = vertices;
 }

when you have all your vertices into an array, you can manipulate them as you want.

beware, you may not know :

that there may be several vertices sharing the same position and their position is also stored in LocalSpace (that means their coordinates are relative to the object position)

Unity Documentation about the Mesh Class is here

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 AmoralAckbar · Jun 21, 2013 at 03:49 PM 0
Share

This is right. One thing to add is that I think you need to recalc normals after modification if you want the mesh to look right.

avatar image saberboy117 · Jun 21, 2013 at 09:44 PM 1
Share

Great, how can I identify the closest vertex based on a ray cast? Dist comparison based on impact point?

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

16 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

Related Questions

Procedural Vertex Snapping 1 Answer

Real time vertex paint (or similar solution) possible? 2 Answers

Vertex Texture Lookup Breaking in Unity 3.5 0 Answers

How do I alter vertex displacement based on UV coordinates? 0 Answers

Tree vertices never change position in wind 1 Answer


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