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"

Ragdolling in Multiplayer

Hello there guys,

I'm having some troubles with ragdolling in a multiplayer session.

When I apply the following code in my gamemode cpp, only the server session ragdolls the players who should be ragdolled, the client doesn't seem to apply the code.

 for (FConstPlayerControllerIterator Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator)
         APlayerController* PlayerController = *Iterator;
         if (PlayerController)
             ASurvivalCharacter * pPlayer = Cast<ASurvivalCharacter>(PlayerController->GetPawn());
             if (pPlayer && !pPlayer->IsPendingKill())
                 pPlayer->GetMesh()->SetAllBodiesSimulatePhysics(true); // doesn't apply on client
                 pPlayer->GetMesh()->SetSimulatePhysics(true); // doesn't apply on client
                 pPlayer->GetMesh()->WakeAllRigidBodies(); // doesn't apply on client
                 PlayerController->UnPossess(); // Is applied

Is there something I'm missing?

Do I need to replicate the functions I've called?

Example Image:


Product Version: Not Selected
more ▼

asked Mar 01 '15 at 04:11 AM in C++ Programming

avatar image

3 1 2

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

1 answer: sort voted first

I can't quite remember, but I believe that the game mode object only lives on the server. So that means you'll need to create a member function on your ASurvivalCharacter that get's called on the server but executed on the client. You do that by declaring a function as an RPC with the Client keyword.

 // Inside ASurvivalCharacter class declaration
 void DoTheRagDoll();
more ▼

answered Mar 01 '15 at 06:29 AM

avatar image

686 15 13 128

(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