mecanim "And" operator for conditions

I am trying to make a transition between my idle state and my locomotion blend tree. unit can move forward and backward, so +1 and -1 on my forward axis, i want to check if (Forward>01 && Forward <-0.1) we are moving. i have setup my condition like this but it return false every time, any idea ?

(Forward > 0.1 && Forward < -0.1) is impossible, so of course it will always be false.

do you mean is it impossible using mecanim ? i want to do something like this equivalent by scripting

float onevar = 1;
        if(onevar>0 && onevar<2)
        Debug.Log ("true");

so im checking if im moving forward or backward, its impossible with mecanim ?
how should i handle this?

In this example you are checking for a value between 0 and 2, but in your first example you’re checking for the value to be both negative and positive at the same time, which never exists.

Do you understand how the && operator works?

Here is the link, if its unclear.

i maybe typed too fast the example, i tried to do this:

public float speed = 0f;

        if (speed < 0.1f && speed > -0.1f)
                        Debug.Log ("idle");
        if(speed > 0.1f || speed < -0.1f)
                        Debug.Log ("running");

On my problem was how to make the difference between OR and And, for the Or just had to add a second transition, so having two transitions of one parameter.

All of the transitions are considered individually in Mecanim so if you need greater control like that you might consider firing Events or maintaining Bool values in Mecanim from your code.

Otherwise, I don’t really see why you couldn’t just feed the speed variable directly into Mecanim and setup transitions between states based on its value.

You can add many condition on transition, all condition must be meet to trigger this transition which mean that they are handle with && operator
1961339--126962--transition.png

if you want an or like operator ‘||’ then you need to create different transition.