Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Cast to not working in Animation Blueprint for Bools

So in the character blueprint I have a variable "is crouching" and I cast to myCharacter to get this variable in the Animation Blueprint and it's not working in game. After some debug testing it seems as though the blueprint is appropriately taking in the input to make the character crouch and the animation plays correctly when I edit the values in the animation preview. (the event is labelled as "Dodge" but is meant to be used for crouching)

Product Version: Not Selected
more ▼

asked Mar 08 '15 at 02:27 AM in Blueprint Scripting

avatar image

12 6 6 8

avatar image mindfane Mar 08 '15 at 03:09 AM

Can you explain the issue a bit more. Are you not able to access IsCrouching from the anim blueprint?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Here's how you cast to an animBP from a different BP. If you are casting to it from the player BP itself, you can just start with the Get Anim Instance node with the skeletal mesh component plugged into it.

Basically, the game needs to know which instance of the animBP to look at, and you need to supply the skeletal mesh in question. For what I used, the skeleton is called "betaguy." As long as you are pulling the player instance out of a casting, it will automatically use the skeletal mesh when you search for Get Anim Instance. Otherwise, you must manually supply its skeletal mesh.

The logic goes like this: Get Player Pawn > Cast to instance of player > Return player instance to get skeletal mesh > Get anim instance from that skeletal mesh > Cast to anim bp instance

Keep in mind that you can do all your casting on Begin Play or some other event, and store them as object variables. You drag the output object pin from a Cast node and select Promote to Variable at the top of the context window. That will save the actual instance of whatever BP you need to talk to, allowing you to grab events and functions and send data by simply dragging the output from a Get object variable node. It's essential for any complex and repeated communication between BPs. You should never cast between BPs more than once.

alt text

Let me know if you need more info! :)

more ▼

answered Mar 08 '15 at 03:10 AM

avatar image

DG Gage
1.7k 62 31 129

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

In addition to the excellent answer provided by DG Gage, I think I see the issue in your current setup. If you take a look at your debugscreenshotone.png, you'll notice that the Object input on your Cast To MyCharacter node has been left unhooked. With this unhooked, the blueprint simply doesn't know what you'd like to perform the cast on. To fix this, drag off of a Get Pawn Owner node and connect it to the Object input of your Cast node. This will basically say, "get whatever pawn owns this anim blueprint and cast it to MyCharacter." I believe that should get you crouching ASAP.

Good luck.

more ▼

answered Mar 08 '15 at 11:15 PM

avatar image

Ray Arnett STAFF
1.4k 45 17 71

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question