Cast to CharBP failed, objectiv pin wrong refreence?

Hi!

I trying to cast from a “Blueprint class” to a “Animation Blueprint” but it fails and i don’t know why, i’m guess that the object pin has the wrong reference but can’t figure it out how it should be. Pic 1 calls the function inside the animation Blueprint from the “Blueprint class”. When i run the game it prints fail.
Pic 1

Pic 2

Grateful for any help!

What’s the patent class of the BP you created and why do you get the owner of the character movement component which can only be sold since nothing is inserted into that node and getting that this way is rated silly. You could just use “Self”.

The BP in the first pic has the parent class of Character, the BP in the second pic is it’s Anime BP(Overwatch BP). I don’t realy get what you mean with the second part in your reply.

I can’t type self in the cast to overwatch BP function, and i can’t leave it blank, that would still make the cast to fail. What I’ve done above in the pics aren’t working either so that’s wrong too :P.

Well yes. You can’t plug that in there because "OverwatchBP is not a character nor a controller. It could in theory be one but it isn’t so plugging it in will always fail.

You need a legit reference to that bp. There are quite a lot of ways and I’m not entirely sure how it’d be best in your case. But you can’t just cast it and expect it to be there.

This could help: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/BlueprintComms/index.html

I glanzed at it and i believe the solution is somewhere in there!

Thanks for your help! I tip my hat…

I guess this will get abit more complicated when you want it to work in multiplayer? Say someone does something on one persons end and it replicates across all others characters if they use the same reference. Maybe that makes less seens when i try to explain it in English…

Thx anyway

Well if done properly it’s exactly the same for multiplayer. You just have to do a little extra work for replication.

But don’t underestimate it. This is object orientated programming. It’s not super complicated but you have to wrap your head around it initially which is programming.

After view and testing now for awhile, it doesn’t solve my problem. Seems weird to me i can’t cast from my Character Blueprint to my AnimationBP to call a function.

Making a object reference doesn’t seem to work cause it the animationBP doesn’t have any instances of it in the level.

Well how do you want to call it then? If an object doesn’t exist it’s not loaded and literally impossible to call.

Find it weird that there isn’t (or more like haven’t figure out :P) a simple way to just say this characters animation BP, what ever it is, call this function with this name (string).

Gonna change it up and cast boolens to trigger functions instead… becomes alot more like spaggti code now.

Try to think of Casting as going down a tree of children to access a function at a lower level that’s not available to all the parents further up that tree. For example, say you had a hierarchy of blueprints going Animal BP → Dog BP → Dalmation BP… And say you want to call a function “CountSpots” on a Dalmation that is a subclass of Dog, which is a subclass of Animal. Starting from a node such as “Get Animal”, who doesn’t have a counting spots function, the way to get there is to go Get Animal → Cast to Dalmation → Count Spots.

So the issue you’re having is you’ve started with a Get Pawn Owner node, which should return a Player Controller reference. Anim Blueprints do not exist further down the tree starting at Player Controller. Anim Blueprints exist as a property on a Skeletal Mesh instead.

The mesh should already be a component in your character blueprint, so drag that from the variable list out into your blueprint. Pull off from its pin and choose “Get Anim Instance” (Target is a SkeletalMeshComponent) to get the generic Anim BP on this mesh. Now Cast from that to your Overwatch BP and you’ll have access to your PreVaultTop function.

Did you look at the anim graph yet? That’s usually used for animation handling.

ofcourse, in my mind what i’m trying to descibe seems like the most logical and straight forward approach. Maybe the best way is to redesign my logic so it utilies the anime graph more.

The way is thru Mesh → Get Anim Instance … see my answer below.

Thank you! It works now.

You been very helpful!

can u tell us how u fix this Pls?

Well if you look at the first pic in this post i didn’t have the understanding that you needed to reference the skeletal mesh in the Blueprint you want to cast to the anime BP. / The target is Character (Character movement) ← should say The target is Character (“What ever you named your skeletal mesh”)