When I unpossess vehicle. Vehicle not slows down

Check out this thread: GTA Style Vehicle Interaction - Project File Included - Community & Industry Discussion - Unreal Engine Forums

It has the answer to your question and it also has a multiplayer-ready sample.

I don’t know what I am doing wrong, but when I unpossess vehicle in Vehicle template than it will driving straight. It stops really slow, wheels are spinnig even if it hits wall.

Probably misreading some inputs for vehicle movement, because when I release throttle and I have it possessed. It will stop in much shorter distance. Even when I try reset input’s in “Unpossessed” event like that:

34214-bp_vehicle_unpossessed.png

For example: You can try unpossess vehicle when you gain some speed and turn. Vehicle still go ahead and turn.

Is that some my problem in workflow or it’s bug?

Thanks, idea behind that is not bad. In that project with gas on the floor, it doesn’t work either. But is there a solution, in making a boolean variable that can affect inputs and after that using the solution with delay, before unpossessing, solve that.

One more time, thanks Jacky for aiming me to the right direction to solve that issue.

I have proper solution, but it is C++ only:

You need to create custom vehicle component and override function UpdateDrag(), also you need to call another custom function (FullClearInput) before leaving vehicle with no controller.

.h

void FullClearInput();

virtual void UpdateDrag(float DeltaTime) override;

.cpp

void CustomVehicleComponent::FullClearInput()
{
	ClearInput();
	ServerUpdateState(0.f, 0.f, 0.f, 0.f, GetCurrentGear());
}

void CustomVehicleComponent::UpdateDrag(float DeltaTime)
{
	APawn* MyOwner = UpdatedComponent ? Cast<APawn>(UpdatedComponent->GetOwner()) : nullptr;
	if (MyOwner && MyOwner->GetController())
	{
		Super::UpdateDrag(DeltaTime);
	}
}

Epic, this should be available out-of-box.

Really helped unlike all other solutions. Thank you!

Fantastic solution! It’s also useful to make the fourth parameter, which is handbrake, to set it to 1.0f so vehicle stops quickly). It’s almost 2020 and issue still perists…