Skip to content

[BUG] LSequence containing two or more Appended LMotion using .BindToScale (Possibly others) causes Drastic scale change on first frame before following LMotion #290

Description

@flmrw

When an LSequence contains more than two LMotions using .BindToScale, the initial scale value of the first LMotion is not applied correctly.

Instead, the object initially appears at a scale close to Vector3.one, then immediately jumps to the expected starting scale and continues the animation on the next frame. However this does not happen if there is only one LMotion in a Sequence.

Expected behavior:
The object should start at the first LMotion's initial scale as soon as the sequence begins, without any visible frame at an incorrect scale.

Environment

  • Latest LitMotion Version
  • Unity 6.3

Describing the Bug in the Code:

We are basically starting the Scale of the Object from zero. But when this code runs, for the first frame the Object appears with scale close to 1. Before we call PlantGrow(), we make sure the scale of the object is set to zero and other necessary safety codes are written.

 cube.transform.localScale = Vector3.zero;
 PlantGrow(cube);
//Notice the huge time duration 100 seconds!!
//Any time duration value works, but 100 seconds helps easily visualize the BUG.

private void PlantGrow(GameObject cube)
    {
        LSequence.Create()
            .Append(LMotion.Create(Vector3.zero, new Vector3(0.8f, 1.2f, 0.8f), 100.00f)  //Notice the 100 Seconds here.
                .WithEase(Ease.OutQuart)
                .BindToLocalScale(cube.transform))
            .Append(LMotion.Create(new Vector3(0.8f, 1.2f, 0.8f), new Vector3(1.1f, 0.95f, 1.1f), 0.2f)
                .WithEase(Ease.OutQuad)
                .BindToLocalScale(cube.transform))
           .Run();
    }

Steps to Reproduce the bug

  1. Open an Empty Unity Project
  2. Create an empty GameObject and drag and drop Movement.cs (Present in Stuff.zip)
  3. Assign a cube Prefab with pivot in the bottom. (I have provided this).
  4. Run the game and Press the 'F' key. [New or Old Input System does not matter]
  5. Notice the object appearing suddenly.

https://youtu.be/FWKy7DUpjjY?si=uk1EtZgS57Hl9rfg
^Video Footage of the Bug
(Could not capture it in screen record btw)

Stuff.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions