• Editor
  • Is it possible to control the timeline with mouse position

  • Изменено

like i make a animation the ball moving right from left
so if it played ball moving right
but i want to make it controllable position

when in game, the bone tracking the mouse position and the timeline follow the position of bone
it's different the ball following other bone position

i could use slider to it, but this way seems be intuitive to control it
maybe this game using this technic: NIKKE

  • Misaki ответили на это сообщение.
    Related Discussions
    ...

    Yes, it is possible to control the timeline with the mouse position, but it requires some custom implementation. Here are some steps and considerations based on the provided contexts:

    1. Using a Bone to Track Mouse Position:

      • You can use a bone to follow the mouse position. This can be done by manually updating the bone's position based on the mouse coordinates. For example, you can use the SkeletonUtilityBone component in Unity to make a GameObject follow a bone's position or override it manually.
      • Example:
             Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
             bone.SetPosition(mousePosition);
    2. Animating Based on Bone Position:

      • Once you have the bone following the mouse position, you can use this bone's position to control the timeline. This can be done by interpolating the animation based on the bone's position.
      • You can create a system where the bone's position determines the current frame of the animation. For example, if the bone moves from left to right, you can map this movement to the timeline's progress.
    3. Using Sliders for Interpolation:

      • As mentioned in the context, using sliders can be a simpler approach for many tasks. You can create a slider that represents the timeline's progress and link it to the bone's position.
      • Example:
             float sliderValue = Mathf.InverseLerp(minX, maxX, bone.position.x);
             animationState.Time = sliderValue * animationDuration;
    4. Combining with Unity Timeline:

      • If you are using Unity, you can use the Timeline extension to scrub through an animation clip during play mode and have it apply to your in-game skeleton.
      • Example:
             // Assuming you have a reference to the PlayableDirector
             playableDirector.time = sliderValue * playableDirector.duration;
    5. Considerations:

      • Ensure smooth interpolation between the bone's position and the timeline's progress to avoid abrupt changes.
      • You might need to handle edge cases where the bone's position goes beyond the intended range.

    By combining these techniques, you can create an intuitive system where the timeline follows the bone's position, controlled by the mouse.

    rmx I'm not sure I understand your question. Is it a question about the operation in the editor, or about the implementation in the runtime to make the bone follow the mouse?

    • rmx ответили на это сообщение.
      месяц спустя

      Misaki
      About runtime feature so can make game supporting avatar system easier
      its slightly different with skin

      Misaki because it needs so much slots i want to supporting accessories of layers
      and each slots just needed toggle
      it feels big waste making skin or animation just supporting toggle accessories

      If I understand what you want to do, you can create an animation and then set the time manually at runtime instead of letting it play. This way a single animation can define many attachment swaps or other behavior.

      In many projects I create an animation with 1s duration, then at runtime I set the time between 0 and 1, like a percentage. This way I can have things animated at runtime, but not controlled by wall time like normal playback.