Search Unity

Changing the Mesh

Discussion in 'Scripting' started by AlbertSommerlund, Feb 14, 2021.

  1. AlbertSommerlund

    AlbertSommerlund

    Joined:
    Feb 14, 2021
    Posts:
    1
    Hello.

    I could use some help on changing the mesh or switching out the player. I have this simple game where a guy runs around and when he is hit by a burger, i want him to become fatter. I have made two 3D models with the same armature/rig, one thin version of the player and one fat version. How would i switch to the next 3D model (when he collides with an object) while keeping the same position?

    Right now it seems like the animation is controlled by the avatar.

    Btw - I don't know much about coding and unity since i mostly work with 3D.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      479.4 KB
      Views:
      293
    • 2.png
      2.png
      File size:
      528.9 KB
      Views:
      281
  2. exiguous

    exiguous

    Joined:
    Nov 21, 2010
    Posts:
    1,749
    Easiest would be to just remove the thin model and instantiate a fat model. I suggest to have the mesh as a separate child object under a parent game object which has the scripts etc. . This way you can switch out the mesh easily without worrying about the rest of the state (for example health points, position, etc.).