Enable/Disable Input Wheeled Vehicle / Pawn does not work, but works on Actor

Hey Fokls,

last 2 days i worked on Player switch Pawns via. Input. With a bit help of eXi. After a frustrating evening i figured out, that the same blueprints nodes, doesn’t work on “Wheeled Vehicle” Class, but works fine on “Pawn” Class.

Is there something i miss or is it a bug? Last thing (eXi’s Tipp) it could be, that you need to deactivate the input of the player first, using wheeled vehicle. Would nice, if someone could help to answer this.

In the Screenshot bellow you can compare both Actors BP. I hope i didn’t forget something. But i tested it twice.
It just works, if you create the Class as “Actor” instantly.

Consume Input is also active on both.

greetz Spähling

Hello,

I have performed a test regarding your issue, and using a class based on Wheeled Vehicle, I was still able to successfully disable input, however, I did go in and deactivate the input of the original character first. Have you tried this?

That is a good question. Right now iam totally uncertain. You should keep in mind iam a 3D Guy, so i really easy mess things up with Blueprints ;).

Well about the problem.

I started with the 3d side scroller template. I didn’t used a custom player controller class. Maybe this is the point, where the problem starts. Cause if i disable the input for the char, i can’t do anything, also pressing the Input Key for switching the pawns.

well, this isn’t a bug, if you say and it’s a problem i produced myself, cause of unknowledge. Iam pretty sure about this. ^^
Anyway, any ideas where i could start to search?

Btw. the Possesing works, if i call the event via. Overlapp the Trigger Volume of my Pawn.

Have you tried setting up an event to possess your vehicle where it was something along the lines of: Key Press->Possess->Disable Input. However, what you’d need to do in this situation is create 2 player controllers. One for your Actor, and one for your Wheeled Vehicle. Then, when you possess the vehicle, ensure that you are using the Wheeled Vehicle controller to possess it and then disable input on the Actor Player Controller. You could attempt a setup such as this and see if that gets you the results you are looking for.

Yeah i also tried to use a Custom Event. That worked, when i call a (lets say) “Enter Vehicle Event” in my character blueprint. But exi told me, that is not what i want to have. Cause i wanna call the Enter and Exit vehicle, inside the vehicle. Not “Enter” in the Char and “Exit” inside the Vehicle.

I also tried to follow, what you say last. but got confused again. Going to make a graphic, what i understand what you said and what i think how it should work. maybe you can see then, where my lag is. hope that helps -.-

I’m having a bit of trouble following exactly what point you are at in your current project. I think the easiest thing would be for you to zip up your project, upload it to Dropbox, and provide me with a link so I can download and take a look at what you have so far. You can PM me the link through the forums: https://forums.unrealengine.com/member.php?160394-Sean-Flint

PN is sended. i also got some problems to follow you. so it with the files its maybe the best. hope you find, what iam doing wrong.

I noticed that the build you sent me did not contain your .uproject file. Could you please provide another zipped up build that has the .uproject? Thank you.

Inside the PN it didnt worked with picture. anyway, here it is again. not sure what you mean. i my .rar the uproject is there. or do you mean something else?

I’ve got it now, thank you. I will look into this as soon as I can and respond with any new information as soon as I have it.

Hello,

Could you please post the images that you provided me in the PM as an answer to this post? It would be valuable to share your workaround with the community.

Hello,

I am marking this topic resolved for the time being. When you have cleaned up the workaround blueprints and ensured that they indeed work for this setup, please post them in an answer and I will come back and accept it.

Have a great day

yeah for sure. Going to clean it up first, also talk to exi again.
but yeah, i’ll gonna defintily do.

also wanted to wait for your answer. what you say, about the workaround.

Hey Sean,

the main problem here is, that APawn overrides the “EnableInput” funtion with this:

void APawn::EnableInput(class APlayerController* PlayerController)
{
    if (PlayerController == Controller || PlayerController == NULL)
    {
        bInputEnabled = true;
    }
    else
    {
        UE_LOG(LogPawn, Error, TEXT("EnableInput can only be specified on a Pawn for its Controller"));
    }
}

This leads to “EnableInput” failing on a Pawn that is not controlled by the passed Controller. So if one calls “EnableInput” with the PlayerController0, that already possess the current pawn, it would fail with the Error message in the “else” above.

The code makes you think that leaving the PlayerController empty would result in bInputEnabled = true, but even with this, the Pawn is not getting Input enabled.

The workaround Speahling has is made by me. He will post the screenshots, which i gave him, later. It’s using the PlayerController as a central position that manages switching. While this is a valid and solid workaround, it does feel weird that the Pawn implementation of “EnableInput” removes the ability to enable Input on a Pawn that you don’t have possessed.

I mean, you can enable Input on an Actor, why not on a second pawn?

If you need more information, just tell me.

Cheers, eXi

Allright, i created a new small project with the workaround inside. For everyone who has problems, can take a look (UE 4.10.4). Hope that helps everything.

A HUGE THANK YOU, to both of you.
The Solution is made by eXi, so all fame belongs to him :slight_smile:

Project Files:

Screenshot Files:


81302-