- Home /
Animator Random Parameter Set
Hello!
So I'm trying to set an int animator parameter to a random number(0 or 1).
The reason is that I want it to randomly choose an attack animation. So, obviously, if u have any better solution to do that, feel free to share them!
So my code looks something like this, there is, also, a trigger parameter that is needed for the animation to play:
function Hit(){
print("LKJHGFGHJI");
transform.LookAt(player);
animator.SetTrigger("Hit");
animator.SetInteger("AttackPose", Random.Range(0, 1)); //Problem must be here!!!
while(animator.GetCurrentAnimatorStateInfo(0).IsName("monster2attack2")){
animator.ResetTrigger("Hit");
yield;
}
}
The answer doesnt have to be in JS!
EDIT:
I solved the problem whch was at a different place of my script. Now my question is if there is a way to delete this question, or something! LOL!!
Are the different attack animations on different frames or are there different animations all together?
They are different animations... but I solve the problem which was at on other place of my script!
Your answer
Follow this Question
Related Questions
How to fix rig animation that stops short when increasing speed? 0 Answers
How to randomly start & stop an animation? 1 Answer
Help implement such attacks 1 Answer
Animation Parameters Not Working Correctly 0 Answers
Random attack animation 1 Answer