Forum rules - please read before posting.

Idle turn animation


       Idle turn animation

When my character turns, he always makes a quarter or half turn (like a lifeless object). I like to have this turn with animation. So when my character is in idle and turns (without walking) i like him to physically turn with animation. What is the best way to achieve this in AC? Should I change something in the Mecanim engine script?

Comments

  • You're using Mecanim animation?  If you define a "Turn float" parameter in your Character's Inspector, then create a parameter by that same name in your Mecanim FSM, then it'll set itself to a non-zero value when the character turns.

    Making your character turn on the spot would then be a simple matter of wiring up an animation that plays when turn is non-zero, but movement speed is zero.
  • I think I have found another way. If I just switch off AC it works like expected. Now I only have to found a way but I am very close.
  • edited December 2015
    In the Char script from line 1094 -till 1101:

     if ((tankTurning || moveSpeed == 0f) && animEngine && animEngine.turningStyle == AC.TurningStyle.Script)
    {
    newAngle = Mathf.Lerp (currentAngle, targetAngle, turnSpeed * Time.deltaTime * GetScriptTurningFactor () / 2f);
    }
    else
    {
    newAngle = Mathf.Lerp (currentAngle, targetAngle, turnSpeed * Time.deltaTime * GetScriptTurningFactor ());
    }
    newRotation = Quaternion.AngleAxis (newAngle * Mathf.Rad2Deg, Vector3.up);


    This is the problem, my script is calculating the position on forehand so it knows which animation to play. Any tips on how I can solve this without re-coding this part of the Char script? Which is already hard for me since this script is not on the player so with references to the Animator that is not on the player it's going to be hard..


  • As I don't know what you did with my last advice, I can only further suggest that you set "Root motion turning" in your character's Inspector all the way up to 1 (assuming you're using root motion).
  • A few days ago I sended a longer message with explenation about the problem, but it first needed authorisation. Didn't you recieve it?

    I thank you a lot for your help and I tried it like you said, which in theory works but in practise not. This is because unity's Blendtree blends all the turn animations as one animation. Therefor Mecanim dev's shows us an example called "precise turn on spot". This is runned by script because it needs to calculate which animation should be played. The problem is this doesn't work very well together with AC. Is this more clear?
  • I didn't get any message, no.

    The v1.50 update (comimg soon) will give you the ability to change a character's Motion control variable regardless of the Animation engine used (currently it needs to be Custom before the variable is exposed).

    With the variable exposed, you'll be able to change it from Automatic to Manual through script - meaning regular movement and turning will be disabled.  Your own script could, in theory, disable AC's turning code when you want to make use of your own.
  • That's great news Chris, thank you so much!
  • edited December 2015
    (PS: my longer message is apparently vanished for unknown reasons but the problem is clear now, looking forward to the update!)
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.