Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to create an elastic (movable) object?

Discussion in 'Getting Started' started by tiho_bg, Feb 20, 2017.

  1. tiho_bg

    tiho_bg

    Joined:
    Jun 24, 2016
    Posts:
    39
    Hi

    I would like to create an object (par example one sphere) with an elastic (movable) tile. Is it possible to create the elastic tile using unity 3d.


    Regards
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    I'm not sure exactly what you're asking here. Are you looking for physical elasticity in game objects? And do you mean tile in the sense of a square piece of some sort, or... How would that work with a sphere?

    Could you go into a bit more detail?
     
  3. tiho_bg

    tiho_bg

    Joined:
    Jun 24, 2016
    Posts:
    39
    Here is a drawing. The tile has to move randomly in 3D space. Therefore I think that it has to be elastic.
     

    Attached Files:

  4. tiho_bg

    tiho_bg

    Joined:
    Jun 24, 2016
    Posts:
    39
    The tile has to be a 3D cylindrical object.
     
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859


    Do you want your cylinder to actually deform (change shape)? Or do you want it to move and bounce off of things, like a a tennis ball? Or something else?

    (I looked at your picture, but I'm afraid I still don't understand what you want.)
     
    PsyfiExists likes this.
  6. tiho_bg

    tiho_bg

    Joined:
    Jun 24, 2016
    Posts:
    39
    The cylinder has to change the shape.
     
  7. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    OK, then you will need to grab the Mesh from the MeshFilter component, and adjust the positions of the vertices. The code sample there (under Mesh.vertices) is a pretty good one to get you started.

    However, this is not really a beginner-level topic — it's intermediate to advanced, I would say. If you're still new to Unity, I would advise you to put this feature aside for now, and come back to it later.
     
    Ryiah and Kiwasi like this.
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    This is one valid approach. An alternative approach would be to use a skinned mesh.

    However you still need to get the underlying deformations. I would approach this by using a bunch of strategically placed GameObjects connected with Rigidbodies and SpringJoints. This is essentially the approach I took in Pond Wars. It's a realatively simple hack on top of the existing physics system.

    I will reecho @JoeStrout's point. This is not beginner level stuff. You need to be super familiar with how the engine works first before attempting this.
     
    Ryiah likes this.