Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

instances of a mesh modified independently

Discussion in 'Scripting' started by molosev, May 24, 2014.

  1. molosev

    molosev

    Joined:
    May 24, 2014
    Posts:
    11
    Hi there,

    Here is my question,

    I have a surface made up of several types of meshes (plain, mountain,...)
    Each type of mesh may appear several times to create the surface.
    This surface will be travelled by a wave which will modify the vertex's height axis of the meshes dynamically.

    I use the GetComponent<MeshFilter>().mesh method to access and modify the meshes vertices

    My problem is that the master mesh is directly modified so that every instance of the mesh reproduce the same portion of the wave, instead of being a part of the main wave. Don't know if i'm clear, please look at picture below...

    Wrong result:
    $01.jpg

    What I want:
    $02.jpg

    Do you know if there is a way to create an instance of the master mesh in order to modify it independently ?

    Is it a better way to import a certain quantity of meshes of the same type (mesh001_type01, mesh002_type01,... mesh500_type01), and to call them when needed, in term of computing time and file size...

    Thanks for your precious help !
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Use Instantiate to instantiate the mesh and modify the instance.

    --Eric
     
  3. molosev

    molosev

    Joined:
    May 24, 2014
    Posts:
    11
    Makes sense !

    I will dig this way.

    Thx