So… Been messing around with this for a bit now. Tried a number of different methods but basically I cannot get this setup to work. This is the closest I’ve got… The client can ragdoll just fine, and it shows up on both server and client instances. But when the server ragdolls, it shows up, but causes the client’s camera to go nuts.
Any help would be great…
Gif of what happens here: (watch the client instance on the right when the server dies on the left)
For the record - I’m aware I probably shouldn’t be multicasting from a RepNotify… but when I don’t multicast and either have the SetRagdoll event to Not Replicated, or even just try to set the Simulate Physics within the RepNotify function, I get this result:
[GIF | Gfycat][3]
Note - in this gif the event is set to Not Replicated, but the same result happens if I just move the logic within the RepNotify function.
I have not messed with this, so I am no expert. I have a few questions & perhaps can help find a solution…
Do you receive any errors in the Output when this ragdoll camera issue occurs?
It looks like the default camera location either didn’t work (failed placement & arbitrarily picked a new and bad location)
Or it’s location is based on the character skeleton (origin point?) & for some reason the server ragdoll supplies a bad camera location in this replicated situation to the client (since client-only works fine).
Without errors, this may be hard to track down… but a theory, nonetheless.
One way to make a ‘Work-around’ may be to build a specific camera script that handles the Player ragdoll:
On Player Ragdoll
Swap camera to previously inactive “Ragdoll camera” (made from a duplicate of the current camera?)
When Player “resumes play” ensure the original non-Ragdoll camera is active & Ragdoll camera is deactivated.
Note: This may allow you to control how the camera behaves on ragdoll; such as a slow pan-away or any other animation to help support the “Game Over: Ragdoll Time” moment, etc.
So I do get some errors actually now that I look. Basically there is still some linetraces drawing from the player camera. On the client, these bug out because they can’t find the player camera anymore. So it seems that setting ragdoll on the server removes the camera from the client… This is feeling more and more like a bug =/
I will give your work around a shot, though it doesn’t quite make sense to me Will see what I can do though.
Hmm well, that line-trace failing is odd. Does that error mention anything specific, an actor & component(s) that fail? The character you’re using likely has a camera attached to a boom (spelling? - moves the camera closer when it bumps into a wall, etc.) and it may be the boom isn’t handled well on the client when a server-triggered ragdoll occurs. This may not be a bug, but an implementation problem on your side. Ragdoll is tricky business, as is server stuff, and you’re attempting to do double tricky business.
Perhaps settings in the player’s camera boom component may help, or somehow disable camera boom from impacting the camera on ragdoll.
You sir are a genius XD If I put my client into first person mode, the issue doesnt happen… so now I just gotta try and find a work around for that haha. No idea what I’ll do there… but that’s the beginnings of an answer!
EDIT: Scratch that. I’m an idiot. This reply was premature lol. That doesn’t fix it. Still testing.
So, ignoring my last comment… the errors that come up are basically suggesting there is no character attached to a controller anymore, like the simulate physics node un possesses the character or something. Most of them are saying that the character ref variable is ‘none’, and one says something about cannot do widget actions as there is no player attached to the controller. Again, these only come up when the server player goes ragdoll.
I tried using a hovering camera behind the player, rather than the camera boom. Same thing still happens. The camera appears to just move to the ground and can no longer be manipulated.
Okay… so I tried it out in a few blank projects and it worked… but the catch is - if I try to run the simulate physics from the CONTROLLER it doesn’t work. Run it from the CHARACTER and it’s fine =/ I have no idea why. Ideally I want to keep as much of my logic as possible in the controller but this is a workaround for now at least. Thanks for your help. If you have any idea why this might be the case that’d be helpful lol but I’ll mark this as solved for now I guess.