No announcement yet.

passing a variable to animation blueprint to control ik

  • Filter
  • Time
  • Show
Clear All
new posts

    passing a variable to animation blueprint to control ik

    Hi, I'm trying to do something that I feel should be very simple but just cannot get it to work...

    What I want to do is have an object in my level that can potentially move around, and then get a character to reach out towards the object or grab it using IK

    The problem that I'm having is that I just cannot seem to pass a variable with the location of the object onto my animation blueprint. I've tried all sorts of methods such as blueprint interfaces, searching an array of the object types etc...

    I can access the location easily enough in every blueprint other than the animation blueprint and I can move the IK to a location I specify in the animation blueprint. I just can't work out how to put the two together.

    I feel as though I must be missing something... any advice on the best way to set this up?

    Not sure if this is what you need, but try something like:

    Click image for larger version

Name:	Screenshot 2014-05-01 15.57.40.png
Views:	1
Size:	65.1 KB
ID:	1050386


      thanks for the reply but I'm not sure I'm totally following what this does or where that blueprint should be located?

      Basically all I need to do is to pass a variable into the anim BP but I just constantly get 'variable is not in scope'. I have no idea what this means...? Here is a simple version of my BP to show what I'm trying to do:

      This is in my character blueprint. The 'Target Actor' variable is set to editable so I can pick the target from the scene. This part is all working fine
      Click image for larger version

Name:	characterBP.PNG
Views:	1
Size:	59.4 KB
ID:	1050397

      next in my animation BP I'm passing this value in and assigning it to a variable. This is where I'm having an issue as the variable is not being passed (I get 'variable is not in scope' when running the game:
      Click image for larger version

Name:	animEventGraph.PNG
Views:	2
Size:	55.6 KB
ID:	1050396

      finally I use this set variable to move the IK (this bits working fine provided I could set that variable):
      Click image for larger version

Name:	animAnimgraph.PNG
Views:	1
Size:	100.8 KB
ID:	1050398

      Again thanks for any help or to anyone that can shed some light on this Seems like it should be such a simple thing to do!


        I'm still learning this stuff myself, but I would try to use the mesh component in your character blueprint to get it's amin instance, cast it, then use the cast to set the animation variable. Good luck


          Fixed it! It turns out that it was working all along... but for future reference or anyone having similar issues here's what was causing me grief.

          Having a look at the contents example file they also have the 'variable out of scope' once its been cast, so just ignore this. I'm not sure what that means so I don't know if its intended or a bug or just a lack of functionality (it certainly makes things harder to bug fix though when you can't trace your variable being passed around).

          The problem that I had is that I simply needed to change the end effector in the '2 bone IK' node to be in world space rather than component space. Makes complete sense really as I am passing in the location of an object in the world! Anyway that took me a whole day to work out haha