I took a tutorial (this one /watch?v=q-FPR1I2B74) to get a skeletal animation to play upon command. I managed to get it working with a knight character that would jump or dance depending on a key press, here is footage of it working (/watch?v=28wpsMpuVVA). I’m now trying to set up the same system with a HoloLens so that upon voice command, he will perform actions. I’ve set up the same system but it’s not playing the animations and I don’t know why. I’ve attached a picture of my code below.
The animations are controlled in an Animator, with boolean parametres changing from false to true or vice versa to turn the animations on or off.
When I say “bounce around” into the microphone, it’s supposed to print a line to let me know the command was received, then sets the boolean parameter to true which in turn will play the animation inside the animator. After a two second delay, it should invoke another void to set it back to false so that the animation doesn’t loop.
When tested, it prints the lines to the Visual Studio output window so I know it’s receing the command, but it doesn’t play the animations.
I tried putting key press commands in to test it and they sometimes work, but not always. I’m really baffled because I can’t work out why the animations aren’t playing. I’ve attached a picture of my animator too in case that helps.
Does anyone know why the animations aren’t playing, or failing that, is there a different/better way I could try to set this up?
you need a bool flag, or read the parameter if isJumping is true in animator…
fix your update loop … this is how it goes>>
if(get jump key && anim.GetBool is false)
{
OnJump();
}
that’s all…
this means when you press space bar… the character will jump Only if the character currently not jumping…
this will make it work right… and prevent spamming jump animations… then jump will be false automatically by NoJump() function when it gets invoked after 2 seconds…