Forum rules - please read before posting.

Feature request | Align player position to timeline's player position

Hello Chris,
Would it be possible to add a feature (if there isn't one already) that lets you align the game's player position with the timeline's last known player position?

For example, I enter a hotspot, interact with it and play a timeline.

In the timeline, the player makes a few steps and ends in a different position from the one where the interaction occurred.

When the timeline ends, if the toggle (match timeline's player position) is checked, AC automatically places the game's player position with that of the timeline's last frame.

This would create a much smoother transition between cut-scenes and gameplay, imo.

Cheers,
Matteo

Comments

  • Would this be for a 2D or 3D game?

    With 3D, if you use Root Motion to control movement then position changes should apply by default. Otherwise, you might be able to use a variant of this script on the wiki that applies changes to rotation:

    https://adventure-creator.fandom.com/wiki/Sync_character_rotation_after_Timeline

    Try replacing the OnCharacterExitTimeline funtion with:

    private void OnCharacterExitTimeline(Char character, PlayableDirector director, int trackIndex)
    {
        if (activeDirector == director)
        {
            activeDirector = null;
            character.Teleport (character.GetAnimator ().rootPosition);
        }
    }
    
  • Thank you Chris,
    I am not using root motion during gameplay, but I managed to get it to work by doing the following, as you suggested.:

                private void OnCharacterExitTimeline(Char character, PlayableDirector director, int trackIndex)
                {
                    if (activeDirector == director)
                    {
                        activeDirector = null;
                        character.Teleport(character.GetAnimator().rootPosition);
                        character.SetRotation(character.GetAnimator().rootRotation);
                    }
                }
    

    I removed the same function from the update, not sure what it was doing there.

    Would be nice if this behaviour could be part of the native Engine: Control Timeline AL.

    Thanks again for your help!

  • Oddly enough, I don't have an issue with this on my end - no such script is necessary for a non-root motion character to retain their position after a Timeline sequence.

    The positioning behaviour and settings in Animation Timeline tracks have been subject to quite a few changes with each update, IIRC. It may be dependent on your Unity/Timeline version. What version are you working with?

  • I am using Unity 2021.3.9f1 and AC 1.75.8

  • Timeline version, I meant.

    Share shots of it including the Inspector for your Animation track as well.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.