Forum rules - please read before posting.

Extra animations: climb ladder, rope, push objects...

Hello community!

I'm developing an adventure game in which we can execute extra actions such as climb ladders or ropes, push objects, go up&down stairs... like in Pan-Pan: A tiny big adventure or Lara Croft Go games, for example.

For testing game, I downloaded a character from Unity Asset Store that is ready to be configured using Mecanim.
By other hand, I downloaded animations from Mixamo that I need.

Following 3D Adventure Tutorial I was able to configure the basic actions such as Idle, Walk, Run... but I don't know which is the valid system to use with AC to recognize and execute correctly those extra animations.

At first, I test with the climbing ladder.

My idea is:
  • Add Animation in Animator Controller.
  • Execute an Actionlist when the player interacts with ladder.
  • Runs a "climbing ladder" animation, and the player goes to the upper level.
  • With a trigger on the top of the ladder, runs an animation like "finish climbing" and finishes the "climbing" animation.
  • If this works, use the same system but inverse for the character to go down.
Now, the action is executed properly but the character doesn't ascend.

My questions are:

Is it possible to do all this system using AC, or it's necessary to do it through scripts?
Is AC compatible with programming a character by scripts?

Thanks!

Comments

  • First of all, I need to give the disclaimer that this type of game isn't the kind that AC is built in mind for.  That said, animation playback is generally flexible though custom scripts can obviously help.

    The playback of animations on Mecanim characters should be left largely to changing Animator Parameters - and this can be done either through the Character: Animate Action or through script.

    Having a character elevate while playing an animation can be done by using Root Motion, and having the "climbing" animation affect the character's Y position.  A custom Action or script could toggle the Animator's "Root motion" property if need be.

    Alternatively, you could attach a Moveable component to your Player's root, and use the Object: Transform Action to move them by a set distance over time.

    It might be more appropriate, however, to rely on a custom script that controls movement / animation playback automatically based on a "height" value you can set in the Inspector.  By controlling your character's "Motion control" field at runtime (see the Manual's "Custom motion controllers" chapter) it's possible to override your player's motion whenever you need to.
  • Hello Chris,

    The games references I told is by type of animations.
    Video game that I really want to develop is a 3D Isometric graphic adventure and, in some cases, I would like the character to be able to perform these actions but as if they were a "cutscenes".

    My programming level is very basic so I've been searching for different Unity tutorials.
    So far I've got run the action "climb ladder" on the player when play the game, and goes up in Y axis, but I just didn't get is controlling that action so it runs when we click on the ladder.

    I understand that I must use the parameter created "IsClimbing" so that, when it's TRUE, the player executes the climb action.

    I have created an interaction with ladder that changes the state of "IsClimbing" to TRUE but I don't know how to indicate this change into the script.

    Somebody can help me?

    Thanks!

    <code>
    public class PlayerExtraAnimations : MonoBehaviour {

        public Animator anim;

        Vector3 tempPos;

        // Use this for initialization
        void Start()
        {
            anim = this.gameObject.GetComponent<Animator>();
        }

        // Update is called once per frame
        void Update () 
        {
            Climb();
            //ClimbRope();
            //Stairs();
            //PushObject();
        }

        void Climb()
        {
            tempPos = transform.position;
            anim.Play("ClimbLadder");
            tempPos.y += 0.01f;
            transform.position = tempPos;
        }
    </code>

    https://www.dropbox.com/s/ojp6ahimt9i4gnv/VerticalStair_Use.png?dl=0
  • You don't want to have your Update() method run the "ClimbLadder" animation every frame - that should be taken care of by the Action anyway.

    You can, however, check if the Player's "IsClimbing" parameter is True before running Climb():

    if (anim.GetBool ("IsClimbing"))
      Climb ();

    That said - this isn't a general Unity or coding forum, so please let's keep this to strictly AC-related questions and issues.
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.