[SOLVED] Controlling vehicle without possessing it

I solved it while writing this post but decided to post it anyway, maybe it will be useful to someone else or maybe someone will point at some significant downsides in this approach.

I made a mistake of making too many things in my game dependent on my character, so there are get player character then cast to mycharacter and do something with it like set or get a variable, all over my blueprint. Now I added vehicles but when player possesses a vehicle half of my game stops working because it tries to refer to the vehicle as if it was myCharacter. To fix this I could add a reference to my character in a vehicle when it is possessed and then check every time I need anything if player character is mycharacter then do whatever it needs, else cast to myvehicle, get reference to mycharacter and do whatever it needs to do. But I’d like to avoid that, so I thought, alright, I’ll just control the vehicle from my character blueprint. Actually that would make a perfect sense, I don’t want my character to be a vehicle, I want my character to be IN a vehicle and control it. I added vehicle variable to my character and when I add input to my character I also add it to the vehicle. If it worked I’d just disable physics on my character and attach it to the vehicle. But it doesn’t work.

=== At this point in typing this post I had an idea, tried it and it worked ===

All I had to do is to add Spawn Default Controller node with vehicle as a target, at the same place where I set vehicle variable on a player, now it just works. I tried setting default controller of my vehicle to Player Controller before but that didn’t help. But adding Spawn Default Controller node fixed everything so the solution is turned out to be very simple.

Hey I also want to do this but I am Spanish and can hardly understand English and I am writing this also from translat it and so can you explain this in detail and i am also very new to ue4 so please can you do a video on it,pleaseeeeeeeee I am very confused.

And can this be replicated?

This thread is five years old and sadly I don’t remember what I was trying to do and why. Looks like my game logic was bad and I was looking for a workaround. You’d be better off looking for a different approach.

actually,I have to do the same thing but there isn’t anything like this anywhere on Google but np,I’ll try to chat with a guy and if you can so please explain it otherwise no problem.