Search Unity

  1. Dismiss Notice
  2. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  3. Dismiss Notice

Switch between animations

Discussion in 'Animation' started by Synapz, Nov 25, 2014.

  1. Synapz

    Synapz

    Joined:
    Oct 2, 2014
    Posts:
    16
    Hello,

    I have a ton of animations imported from cinema 4d and its about a little fish on a fish floor swimming. with see weed and some other stuff... i also have the same scene but then everything is dead.. fish is fishbone swimming, sea weed hangs but still waves with the water. (water is not visible btw, just the motion)

    i have this lardy working with playmaker but i want to recreate this without plugins.
    the idea is that when you push a button that the the whole scene switches from alive scene to dead scene..
    so both scenes need to play constant and at the same time..
    the fish for instance swims a certain path and when you switch the dead fish needs to be in the exact same place where the alive fish ended and vice versa.

    so to makes things a little more easier.
    i have one alive see aeed waving
    and one dead sea weed waving.
    there at one another in the scene and when i hit play they both begin waving and going the same way.
    my question now is. how can i switch between them?
    do i need to script the alpha? or something else?

    In playmaker i could set the alpha, but even when the alpha was 0 the animation still plays, you only can't see it playing. but i don't want to use plugins.

    hope you guys can help,
    Thnx in advance!!!

    Nick
     
  2. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    If I understand this correctly, this is not really an animation question. This is really a rendering question. Now, I'm not a coder, but there are ways to turn off the rendering of meshes, and I'm pretty sure you can do this with code. Even in the side panel, when you select an object in the scene, there is a check box in the Mesh Renders. If you uncheck that, you won't see the mesh anymore. So, you could just toggle each mesh render on and off.
     
  3. Synapz

    Synapz

    Joined:
    Oct 2, 2014
    Posts:
    16
    Hi medhue, thank you for your reply, i knew the mesh renderer check box, for me its called skinned mesh renderer,
    probably because i made an animation with bones controlling the mesh. but anyway, i need to set that or some other way to a button so i can switch it with the push of a button :)
     
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,788
    So I've been working on some characters that have there loadouts (clothing/armor/hair) switched our in code. Similar to medhue I don't deal with the code side but I have created several clothing pieces and the coder turns on/off the pieces at run time when the item is selected for a character.
    I've also read somewhere (can't remember) that this process can also be controlled by alpha masking in the texture/material.
    With the two options I mentioned everything is in the same scene and visibility is controlled via code.
     
  5. Synapz

    Synapz

    Joined:
    Oct 2, 2014
    Posts:
    16
    thank you for your reply but i still don't understand how to set this up in unity. how do you switch between objects?
     
  6. TMPxyz

    TMPxyz

    Joined:
    Jul 20, 2012
    Posts:
    765
    It is more "formal" and "technical" to change each MeshRenderer & SkinnedMeshRenderer 's mesh,

    but if you just want to get things done fast, the simplest method is to place the "dead scene" 100 units below the "alive scene", and move the camera position when you do the switch.

    And you need to set all the animation/animator component's culling mode to "Always animate".
     
    medhue likes this.
  7. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    or possibly, have 2 cameras, and switch between them.
     
  8. Synapz

    Synapz

    Joined:
    Oct 2, 2014
    Posts:
    16
    will try these options. thnx guys!!
     
unityunity