How Do I Combine Controllers?

I have 2 controllers, one for the character, and one for the vehicles.

  1. (PlayerController)
  2. (TP_VehicleController)

How do i combine these controllers so the character is able to use the vehicles from the Vehicle Controller, while only using the Player Controller?

i am completely stuck on this and cannot proceed with my project until i get this fixed, i have been trying to figure this out for months!

Unreal actually has a fairly easy way to do this. Since PlayerControllers control a specific Pawn (which is a parent of both Character and WheeledVehicle), you can easily swap between the character and vehicle by calling Possess on the Controller, with the Pawn you want to control as the target. Like so:

238069-possessing-pawns.png

You can also track whether you’re driving or not in the Controller with a simple Boolean variable that you update when you switch between player and vehicle. With this variable, you can use Branch nodes to handle different behavior, like so:

I hope this helps!

This worked!
But leads me to a new problem haha.

I want to make it so when the character takes controll of the vehicle, and then exits the vehicle, how would i make the character be in the same place as when first entered the vehicle?
I need to save the location from entry, and go back to that location on exit.
If that makes any sense??
Thanks so much for helping me out with this. I am definately getting somewhere now as i have been stuck on this for months.

The vehicle is a big ship. I am trying to make it so the character walks up to the wheel, takes controll of the ship, presses key to possess player again, and then be at the same location where the character was originally. Or atleast anywhere on the ship.

You’ll want to look into the AttachToActor and DetachFromActor nodes for this. You can call AttachToActor on the player to attach it to the ship when you possess the ship, and then call DetachFromActor on the player to detach if from the ship when you repossess the player.

The attachment rules on both nodes should all be set to Keep World so the player’s world position will follow the ship properly. Weld Simulated Bodies should be turned on for AttachToActor because it will lock your player to their spot in the ship and prevent them from sliding around.

I owe you my life, sir. lol
Thank you so much. i will try this and get back to this post at some point, but i believe this will work.