#pls help

1 messages · Page 1 of 1 (latest)

shrewd blade
#

pls help

main sluice
#

GetButtonDown and GetButtonUp

shrewd blade
#

if (Input.GetButton("Fire2"))
{
animator.SetBool("ADS", true);
}

    if (Input.GetButtonUp("Fire2"))
    {
        animator.SetBool("ADS", false);
    }
#

when I make it like this

#

it bounces back and fourth

#

it's the same with getbuttondown

#

@main sluice \

main sluice
#

GetButton fires every frame the button is held

#

That is not what you want

hybrid spruce
#

if (Input.GetButton("Fire2"))
{
animator.SetBool("ADS", true);
}

to

if (Input.GetButtonDown("Fire2"))
{
animator.SetBool("ADS", true);
}

shrewd blade
#

doesnt work

#

it bounces

main sluice
#

Then your issue is most likely with your animator

#

Once you switch to ButtonDown and ButtonUp

shrewd blade
main sluice
shrewd blade
main sluice
shrewd blade
hybrid spruce
#

i think something else override the parameter ADS

#

reading through the code all ADS para mention only 2 time with mouse2 up and down (3 if you count on enable)

shrewd blade
#

yep

hybrid spruce
#

and it working as expected so problem is some where else

shrewd blade
#

its seperate

hybrid spruce
#

not the input itself

main sluice
#

Does your animation loop

#

It probably shouldn't

shrewd blade
#

no

hybrid spruce
#

did you use Animation event?

shrewd blade
#

wait is loop this

main sluice
#

Uncheck that, and go into the clip itself and make sure it's not set to loop

shrewd blade
#

nothing changed

hybrid spruce
#

add condition where ads animation have to has ADS false in order to move from ads to idle?

shrewd blade
#

so a bool?

hybrid spruce
#

it your ADS bool

#

it too small lul

shrewd blade
#

what do you mean

hybrid spruce
#

i see it

#

yout ads animation take no reload

shrewd blade
#

I make a new bool in the script?

hybrid spruce
#

then it will move back to idle

#

no

#

re use it

shrewd blade
#

re use reload

#

but with the new animation instead?

hybrid spruce
shrewd blade
#

ok

#

i see

hybrid spruce
#

delete the reload one

shrewd blade
#

stupid me

#

thank you

#

it fixed the problem