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"

How can I get character gravity scale to replicate across network?

So far I've got this

 UFUNCTION()
         void SetupGravity();
 UFUNCTION(Reliable, Server, WithValidation)
     void SetPlayerGravity();
     void SetPlayerGravity_Implementation();
     bool SetPlayerGravity_Validate();

then implemented like so...

 //This is called when I press the letter "e"
  void AKoreChar::SetupGravity()
         SetPlayerGravity();

     void AKoreChar::SetPlayerGravity_Implementation()
     {
         custMoveComp->GravityScale = 1;
         GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::Printf(TEXT("Gravity = %s"), *FString::SanitizeFloat(custMoveComp->GravityScale)));
     }   
     bool AKoreChar::SetPlayerGravity_Validate()
         return true;

This will make the character on the server start to fall. But the clients do not. Even though the On screen debug message which reads the gravity scale of each character shows 1.0f as the value (which means they should fall)

Product Version: UE 4.13
Tags:
more ▼

asked Nov 22 '16 at 03:08 PM in C++ Programming

avatar image

Thumper
966 145 151 391

avatar image Thumper Nov 22 '16 at 06:07 PM

I think it is not using the proper version of the pointer to the Character Movement Component. Does it not know which pointer is which. I would imagine it would be something like Client1->CustMoveCompPointer which fetches the local version of that client...

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

1 answer: sort voted first

Call a net Multicast function, in that function use reference to Movement Component and set Gravity. This will call on the server and on the Clients. The initial call Net Multicast has to be called by the server so use If (HasAuthority()) to make sure it's the server.

more ▼

answered Dec 02 '16 at 04:37 PM

avatar image

Thumper
966 145 151 391

(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