x

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"

Why won't client pawns animate across server?

So, i've gotten stuck on another probably simple problem, but i can't see what might be going wrong. I am assigning pawns to players through C++, and the animations are handled through blueprints. The client can see their own animation, but can only see each other's idle animation, the pawn physically moves around, but it does not transition to other animations. I have the MeshComponentUpdateFlag set to always tick and update bones.

I have a character class, MyCharacter. in the constructor of my character, the skeletal mesh and animation component are assigned as follows:

 enter code here/* Component attachment / configuration / creation */
     static ConstructorHelpers::FObjectFinder<USkeletalMesh> MyMeshObj(TEXT("SkeletalMesh'/Game/Characters/MyCharact/Mesh/MS_Ipose.MS_Ipose'"));
     static ConstructorHelpers::FObjectFinder<UBlueprint> MyAnimObj(TEXT("AnimBlueprint'/Game/Characters/MyCharact/Animations/BP_My_ANIM.BP_My_ANIM'"));
     
 
     if (MyMeshObj.Object != NULL)
     {
         MyMesh = (USkeletalMesh*)MyMeshObj.Object;
         
     }
     if (MyAnimObj.Object != NULL)
     {
         MyAnim = (UAnimBlueprint*)MyAnimObj.Object;
         MyAnimClass = (UClass*)MyAnimObj.Object->GeneratedClass;
     }

Then, in my GameMode class, I have overridden the SpawnDefaultPawnFor() function as follows:

  `APawn* AMyGameMode::SpawnDefaultPawnFor(AController* NewPlayer, class AActor* StartSpot)
     {
         // don't allow pawn to be spawned with any pitch or roll
         FRotator StartRotation(ForceInit);
         StartRotation.Yaw = StartSpot->GetActorRotation().Yaw;
         FVector StartLocation = StartSpot->GetActorLocation();
     
         FActorSpawnParameters SpawnInfo;
         SpawnInfo.Instigator = Instigator;
         APawn* ResultPawn; = GetWorld()->SpawnActor<APawn>(MyCharacter::StaticClass(), StartLocation, StartRotation, SpawnInfo);
 return ResultPawn;`

Is it the use of the MyCharacter::StaticClass() that is causing it not to update the animation across the server?

sorry to ask, but i cannot for the life of me fathom what might be going wrong.

Product Version: Not Selected
Tags:
more ▼

asked May 18 '14 at 05:00 AM in C++ Programming

avatar image

CUTIEPIE
61 7 7 9

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

1 answer: sort voted first

I figured out the problem and got the animations to finally replicate across the server. when assigning the animation blueprints in code like this, each state that changes the animations in the blueprints must be replicated.

so in the header:

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = Team2Pawn) 
 bool bIsRunning;
         UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = Team2Pawn) 
 bool bIsWalkingY;
         UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = Team2Pawn)
 bool bIsWalkingX;
         UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = Team2Pawn) 
 bool bIsJumping;

Etc..

then, in the cpp:

 void ATeam2Character::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > &OutLifetimeProps) const
 {
 
 DOREPLIFETIME(ATeam2Character, bIsRunning);
     DOREPLIFETIME(ATeam2Character, bIsWalkingX);
     DOREPLIFETIME(ATeam2Character, bIsWalkingY);
     DOREPLIFETIME(ATeam2Character, bIsJumping);
     DOREPLIFETIME(ATeam2Character, bIsAttacking);
 
 }


i guess its obvious enough, but i wish there was a little more clarification on some of these things. blueprints abstract a lot of details. maybe i'll write a tutorial later.

more ▼

answered Jun 15 '14 at 12:15 PM

avatar image

CUTIEPIE
61 7 7 9

(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