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"

Attaching driver to a vehicle in multiplayer

I am trying to attach my first person pawn to a vehicle in multiplayer, on the listen server it works perfectly, but if a client gets on a car I can control the car perfectly but it kind of jumps around and seems jittery... I've been suspecting maybe its something with the fact there's a pawn with a CharacterMovement component attached to a vehicle with a VehicleMovement component, or maybe something with the Vehicle's movement being replicated and it going crazy jumping around...

I've disabled the movement on the CharacterMovement of the pawn by calling DisableMovement and I also disabled the collision of the CapsuleComponent before attaching the pawn to the vehicle mesh.

Any idea? Thank you.

Product Version: Not Selected
more ▼

asked Mar 25 '15 at 11:11 AM in Blueprint Scripting

avatar image

97 12 12 17

avatar image alperenakyuz Mar 25 '15 at 04:45 PM

Sounds like something's wrong with the replication structure. Can you double-check it?

avatar image Snowcrash5 Mar 25 '15 at 07:03 PM

I'm not sure what you mean by that. Both the car and the pawn replicate and both replicate their movement, I tried disabling replication of the movement of the pawn but it doesn't help. Could it be related to the fact that when the pawn gets on a vehicle it keeps a pointer to it and calls its set throttle and set steering functions from there? (I had to set the controller value on the vehicle to the player's controller in order for it to work).

avatar image alperenakyuz Mar 25 '15 at 07:40 PM

I'm not sure. Can you send some screenshots?

avatar image Snowcrash5 Mar 25 '15 at 08:38 PM

To attach the character to the car I use the following code. This runs on all the clients via a RepNotify.

 CurrentVehicle = NewCar;
 GetCharacterMovement()->bEnablePhysicsInteraction = false;
 this->AttachRootComponentTo(NewCar->GetMesh(), FName(TEXT("CharacterSocket")), EAttachLocation::SnapToTarget, true);
 //problem is not weld simulated targets... tried without it
 NewCar->Controller = this->GetController();

And the car is controlled like this from the character pawn:

 if (CurrentVehicle)

Here's the replication tab for both the car and the pawn:

alt text

Here's a video of the problem: LINK

(remember that on host it works perfectly so I guess its probably something with prediction or some physics screwup...)

avatar image alperenakyuz Mar 26 '15 at 12:12 PM

Does jittering stop when the vehicle's stationary? If so, my guess would be that it's happening because of latency. They solve this problem in GTA V by replicating the client version of the car and host character based on the client character location. It's not a perfect solution but stops jittering.

avatar image Snowcrash5 Mar 26 '15 at 01:12 PM

Jittering does stop when the vehicle is stationary. When I actually possess the vehicle it works perfectly so it must be something with the character being parented to the vehicle. A workaround to all this jittering is setting the characters location every tick to the car's socket location, but that solution seems kinda dirty and I want to know the real cause of the problem.

avatar image alperenakyuz Mar 26 '15 at 01:15 PM

Sometimes delays/jittering occur with attached components and actors even in single player games. This might be an issue independent from the network actually. I would go with the dirty solution if it works.

avatar image Snowcrash5 Mar 26 '15 at 02:52 PM

Hmm, makes sense. Its weird that it works perfectly on the host machine though. But thank you very much :)

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

1 answer: sort voted first

I had this exact problem. Disable the charactermovementcomponent, it applies smoothing which messes things up.

Although I still get some issues placing the character, but it no longer jitters.

more ▼

answered Mar 26 '15 at 02:56 PM

avatar image

150 14 11 17

avatar image Snowcrash5 Mar 26 '15 at 05:00 PM

That did it, thank you :) I disabled the CharacterMovement component via


(and re enabled it doing the same with a true bool)

Is that the right way to disable a component?

avatar image Aussiemandias Mar 27 '15 at 03:09 AM


(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