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

Animation Transitions between different paddle states in an Arkanoid clone

Discussion in 'Animation' started by GregPDesUGD, Nov 6, 2016.

  1. GregPDesUGD

    GregPDesUGD

    Joined:
    Jul 27, 2016
    Posts:
    93
    I am building my own version of Arkanoid and, for learning purposes, want to experiment and try out 3D animation. In this case, I want to create animated transitions between the different possible states of the player's paddle.

    This is a rough 2D sketch of the different states the paddle can be in, as it depends on the different powerups the player collects while playing through 36 levels and five optional, bonus levels.

    Paddle States (Animation).png

    I actually don't know how to start. I'm using Blender to model the different paddle states, because Unity's Animation Window won't let me change the position of a mesh's individual vertices. The paddle won't look right if I just create all the animations on Unity.

    I can create the different animation clips on Blender; the question is when I have to import it. Or perhaps I'm looking too far ahead into this? And is it possible for Blender to load up the different states of the model without having to save it on different files?

    What I want to do is merge the different states together into one mesh so that I don't have to load up the different meshes every time the player collects a powerup, which can slow the game down. The game is being built for WebGL. I don't know what sort of texture map I want to use for this, but I'm only going to figure this out when the time comes. However, since the gameplay window will be at 800 by 450 when submitted on Newgrounds, I don't need to add too much detail to the textures for the paddles.

    From watching the tutorial videos on animation, I need an animation state machine, transitions, some empty states to hold the different states of the paddle that stay as is until an action occurs such as the end of the level, and some states to play the different transition animations of the paddle. For instance, I would have a complete animation state for the paddle spawn, a transition to the paddle's game state, the state itself which happens to be empty, and two transitions to the state where an animation plays for the paddle's destruction, or the state where an animation plays in the paddle disappearing to the next level.

    So, where do I start? I feel like this is a confusing, overwhelming start, which is why I ask.
     
  2. SethMeshko

    SethMeshko

    Joined:
    Sep 20, 2014
    Posts:
    109
    So the only reason why you would want to have the object to deform (move vertices) is if you wanted to animate the deformations. You could model each object and swap them out when they get the power up. These objects will be so light that you wouldn't need to worry about having multiple iterations of it load. However, if you did want to see the object animate the changes then you would want to rig it and animate the change. How you create the animations will depend much on exactly what you want animated.

    When you say animation state for the spawn and transition to paddle, destruction etc. you have to have an idea of what those mean and what sort of geometry will satisfy the criteria. It is very possible that it won't be the same object for each of those "states".

    If you just want the length animated then you would just animate the length. If you want color changes then that is a different story. You will want to do your color changes in Unity. If you want the geometry to warp or morph that is a different rig, if you want it to explode that is also a different rig, possibly not, it depends on if you want any of the shapes to persist after destruction. Different rigs will require different objects.

    Be more explicit about exactly what the changes are and it will help to figure out what you need to do.
     
  3. GregPDesUGD

    GregPDesUGD

    Joined:
    Jul 27, 2016
    Posts:
    93
    Hmm, I'm not sure if I'm thinking of this in complicated terms. But I could start out modelling each of the states of the paddle in Blender, check it in Unity, make changes as needed to make it feel like it looks right, and then try to make the animations. This is also a chance for me to get some information on the keyframes, including how long is the Capsule Collider for the paddle.

    This is how I want the transitions to occur:
    - The Normal Paddle is the intermediate state. Suppose I have an Extended Paddle, and I collect the Mini Paddle. I would then play the clip from Extended to Normal, then Normal to Mini. This saves a lot of time by working on fewer animation clips.
    - When the player collects the Mini Paddle or Extended Paddle powerups, the length of the paddle changes. Instead of using the Scale property in Unity, though, I want to load a new mesh and move a couple of components outwards, closing the gap with a shell. Just extruding a few vertices would make the texture appear out of place; all parts of the mesh can't have their faces move someplace else or change size in the UV map.
    - Transitioning from Normal to Laser simply involves changing the color of the sides of the paddle after loading a new mesh, and extending two barrels from the paddle's body. This is somewhat similar to the Beam Paddle.
    - On transition from Normal to Bomb Paddle, it's simply a color and texture fade, from one UV map to another.

    If I'm not mistaken, I think what I need to do is play the animation clip on that mesh, and then when the animation is finished, load the new mesh into the game object. That's because if I load the mesh too early and play the animation, the user might see the state that the transition is supposed to go on the first frame before the animation plays. In the Animator Window, when you have two keyframes side by side at the end of the clip, is it possible to have the latter keyframe load that mesh for the new state the paddle is in?
     
  4. SethMeshko

    SethMeshko

    Joined:
    Sep 20, 2014
    Posts:
    109
    How complex are your textures for the middle of the paddle? are there things that can't stretch? Is it just a smooth metallic finish or are there details that would deform and look strange?

    If the texture won't look weird stretched then you could rig your paddle with 3 joints. On in the middle that would be the root, then one for each side positioned under the paddle ends. You would skin the center shaft of the paddle with even distribution of weight from the root to the end of the shaft weighted totally to the end joint at the distal most end of it and then have it weighted totally to the root at the cvs that are at the center. Same thing for the other side. You would not scale, but translate the joints away from the center to make the shaft longer. This would have the added convenience of having an object transform exactly where you need to swap out the ends.

    However if all this seems to complex or if you don't need the deformations or if the texture will stretch then what you will want to do is just have all of your objects modeled however you want them all positioned in exactly the same place under a single master object and just and just hide the ones you don't need. You would change the collider shape to match whatever shape you currently had visible.
     
  5. GregPDesUGD

    GregPDesUGD

    Joined:
    Jul 27, 2016
    Posts:
    93
    I don't particularly have any textures at the moment. But looking ahead, I would rather have them look sharp even when some parts extend or changed, because that would let me create sharp, consistent animations. Stretched or deformed textures don't look right.
     
  6. SethMeshko

    SethMeshko

    Joined:
    Sep 20, 2014
    Posts:
    109
    Sorry for the delay. If you are going to have texture stretching issues then just swap out the modles.
     
  7. GregPDesUGD

    GregPDesUGD

    Joined:
    Jul 27, 2016
    Posts:
    93
    Hmm, you know what? After letting this fly off of my head for a full week, I feel like the kind of modelling I want to do is way too much. What I want to do instead is just create one texture and apply it to the center of the paddle. Then, when the paddle extends, just fill the space with a color.

    As I wrote out a story, finally, I think I'm going to make this paddle a federal ship and thus would be white. Only in certain states would powerups come to life and thus the ship changes color and the way on how it is displayed.
     
  8. SethMeshko

    SethMeshko

    Joined:
    Sep 20, 2014
    Posts:
    109
    I think you should start making it immediately and just see what works and what doesn't. Everything is iterative.
     
  9. GregPDesUGD

    GregPDesUGD

    Joined:
    Jul 27, 2016
    Posts:
    93
    A friend of mine told me that I could simply model the paddles, then add a puff of smoke every time a powerup is collected that changes the way the paddle looks to hide a mesh swap. I don't know if it looks appealing, though, even though it's much simpler.