C++ AttachToComponent() doesn't weld on simulated proxies?
I'm working on a multiplayer game with vehicles in it, and specifically I've been working on the functionality for players to be able to enter/exit a vehicle. Players can possess the vehicles perfectly, but when I try to attach the players' previous characters to the vehicle I'm having issues on the simulated proxies. When a player tries to enter a vehicle, there is an RPC call to the server so that they can possess the vehicle on the server. The server then sends a multicast RPC to disable collision and attach the character to the vehicle. This works perfectly on the server and the client that owns the player, but on any other clients (clients that do not own the character that is entering the vehicle) the character snaps to place and then falls through the floor. I've attached a .gif that shows the bug. On the client that enters the vehicle (bottom right) and on the server (top left), the character enters the vehicle and stays welded to is as intended. On the other two clients the character falls through as soon as they possess the vehicle and the character does not stay welded to the vehicle. If anybody has any ideas about what I could be doing wrong here it would be greatly appreciated! Thanks so much in advance!
Here are the relevant snippets of code:
Header File (.h):
Implementation File (.cpp):
asked Apr 06 '19 at 03:04 AM in C++ Programming
As mentioned on the forums (copying here for completeness' sake)
The Character Movement code is still running, it doesn't care what the character is attached to. You're disabling collision but gravity is still being applied, so the character will fall through the floor.
In our projects we've found that we've had to make some customizations to the character to not perform movement when attached to something, and to skip replaying moves when attached.
answered Apr 08 '19 at 07:25 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here