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"

How can I get skeletal mesh animinstance and then cast it using code?

alt text

I want to create basically a copy of this in code. I can get all the way to the Get AnimInstance part but cannot figure out which class to cast to to get the functionality of the cast in blueprints. Thank you for any help you can give you

     /*what do i put here for type*/  *animInstance =  Cast</*again*/>(mesh1P->GetAnimInstance);
Product Version: Not Selected
capture.png (139.6 kB)
more ▼

asked May 13 '14 at 11:23 PM in C++ Programming

avatar image

55 14 13 14

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

1 answer: sort voted first


 //default anim class
   UAnimInstance* Animation = Cast<UAnimInstance>( mesh1P->GetAnimInstance() );

Your Own Anim Instance Class

 UMyAnimInstance* Animation = Cast<UMyAnimInstance>( mesh1P->GetAnimInstance() );

My UE4 C++ Tutorials on Custom Anim Instance

wiki 1


wiki 2


more ▼

answered May 13 '14 at 11:30 PM

avatar image

10.6k 446 346 1088

avatar image TiagoLing Jul 23 '15 at 10:06 PM

I'm trying to do the same, based on your tutorials but i always get the AnimInstance as null - what am i missing?

avatar image yanlec Sep 19 '15 at 07:13 PM

see this link someone has posted the answer


avatar image yanlec Sep 15 '15 at 12:57 AM

same here, cast always fails

edit: ahhh it seems the mesh->GetAnimInstance() always return null for some reason... see here this guy has the same problem

link text

avatar image 1999 Dec 22 '15 at 12:57 AM

I have been trying to do the same thing and there are C++ errors, .h alt text and the source file(On next page post.). Line 42, 45, 93 and 96, UGHFF and Super: name followed by '::' must be a class or name space name. Line 48 "OwningPawn" and "TryGetPawnOwner" is undefined. Line 99: "OwningPawn" is undefined. Line 105: IsMoving is undefined.

screenshot (66).png (105.3 kB)
avatar image 1999 Dec 22 '15 at 01:03 AM

Too big to send.

(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