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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Moving cube like hinge at the edge of the cube

Discussion in 'Animation' started by Roboflame, Sep 30, 2022.

  1. Roboflame


    Aug 30, 2022

    I am trying to get animation for below. My character will be like a 3 separate cube. And it need to change shape like inside photo. I want to control animation state with keyboards.

    Example: 1st state will be 3 cubes will be in straight line. Then, cube 1 can rotate at the anchor of the edge of cube 2 to achieve 2nd position. Then, cube 3 rotate to the top of cube 1 to achieve 3rd position.

    I want to use all cubes in 3D. I tried with hinge joint but no luck as I can't anchor at the edge of the cube.

    Anyone can help me? Thank you Screenshot 2022-09-30 at 3.53.31 PM.png
  2. Nathanieljla


    Apr 18, 2014
    Is this a preset set of motions or a dynamic situation? i.e. can the user move any cube any direction? Off the top of my head (if it's dynamic) I'd probably make a cube prefab, where the cube has a a child along each edge. When the user picks a direction to move, you parent the cube that you want to rotate to the appropriate child and rotate that child over a series of frames via a coroutine or a tween tool from the unity store.