Hello, I have an issue that I don’t understand. I’m attempting to attach my character pawn to my vehicle. It works for the server but no matter what I’ve tried it won’t attach him on the client side. When the server gets in the vehicle It works fine. Also when the client get’s in the vehicle the server see’s the client in the vehicle. But I cannot get the character to attach on the client’s instance of the game. I’ve tried repnotifying back on the character possessing the vehicle pawn before it takes possession of the vehicle. I’ve tried repnotifying on the possessed event of the vehicle. I’ve tried multicasting after the vehicle is possessed. I debugged and watch the repnotify function and the multicast events and see them fire but no matter what I do it won’t attach my character to the vehicle. The client receives the variables so no issues there I believe. I don’t know what else to do. Beforehand I was setting a skeletal mesh component inside the vehicle to the skeletal mesh class from my interact interface which worked fine but I would like to be able to attach my character to the driver seat so he can be shot out of the vehicle like other games and would like to be on a repnotify.
Here is a screenshot of my code (ignore the set hidden in game and some other stuff leftover code from my old method):
I’ve tried doing this but it didn’t help. Well I disabled the cmc component tick. I can try setting to none. Does the cmc still work when the character is unpossessed?
Yeah, to a degree. Controller just applies “Input”.
CMC also uses client-side prediction so it requires movement input from the client first.
Client inputs movement, it moves locally, then RPC’s saved moves to the server.
Server duplicates them on its end then compares results (location, rotation, states etc).
If they don’t match, then the server sends a correction, otherwise an ACK (good to go).
Small corrections are blended over a few frames (smoothed). Large result in teleports (snapped). We see them as jitter.
That being said when you attach a character to something that moves and CMC is still enabled, then the server will snap the client back as a correction. Server is seeing movement that does not have input to justify it.
Disable movement, capsule comp collision, attach it to whatever. RPC the server to do the same.
Once done there RPC Game mode to handle possession.
Don’t confuse this with normal world interactive movement. Say the character steps on an elevator. You don’t have to do anything extra here. CMC will handle it. The issue arises when you attach the character to something that moves. CMC and the server aren’t seeing anything that stips movement.
I’m aware of the client prediction. Hm, I’ll have to do some testing. Currently my interact system runs on server so no need to really do on game mode. But I’ll have to test some stuff… I do this on my spaceship pawn’s tractor beam ability where I lerp character to a position under my spaceship and attach it. Works for both server and client so I’m confused why having so much trouble with this. I believe it may because this is happening while a possession change is happening.
ahhh. Setting movment mode to none seems to work so. Thank you! Before I was disabling component tick since someone suggested that but this actually worked thank you!
I do have one issue for both server and client though still. The first time I get in it works and when I get out but when I try to get in the second time it doesn’t work for server or client.
I have attached my character to vehicles on overlap and on the server they are able to move relative to the moving vehicles. Also, the client can move smoothly, but it cannot see other clients or the server move. The only thing that happens is that other character will run in the direction they did when first overlapping. Any suggestions for why this works on the server while im not able to replicate it to the clients?