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

#Basic

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

#Your Own Anim Instance Class

UMyAnimInstance* Animation = Cast<UMyAnimInstance>( mesh1P->GetAnimInstance() );
 if(Animation)
 {
   Animation->Yay();
 }

#My UE4 C++ Tutorials on Custom Anim Instance

wiki 1

wiki 2

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);

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

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

see this link someone has posted the answer

Answer

I have been trying to do the same thing and there are C++ errors,
.h

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.

Too big to send.