Hi, I’m relatively new to Unreal Engine as a whole, and I’m having an issue with transferring possession and keeping my tick events running.
So, for context, I have setup the third person controller to enter and exit a vehicle (AVS vehicle if that makes a difference). I had the functionality down, but originally the call was inside the character BP, so i worked on transferring it over to the vehicle BP to handle the tick, this way i can adjust it outside of the character, turn the tick off/on when needed, further down the road.
The problem starts when i exit the vehicle. On exit, I set the possession of the third person character back to the player, and set the vehicle possession back to the original ai controller. However, when the vehicle retains possession of the ai controller, I lose my event tick function for that vehicle, which prevents any execution for the player entering the vehicle again.
I’ve narrowed it down to the possession specifically, and have confirmed by printing output through the tick. As soon as i lose possession of the vehicle, the tick is lost. Functions like overlapping continue to work though. Things I’ve tried:
Manually setting tick enabled for vehicle with “Set Actor Tick Enabled” after re-possession
Adjusting Auto Possess settings (Current Settings - “Disabled; Placed in World; AIController”
Tested controller change with vehicle outside of AIController, tick continues as intended if player possessed
Setup:
UE - 5.3.2
Using Enhanced Input System
Working off of third person template
Using AVS Vehicle
Not sure what’s relevant and not, figured I’d just add additional info just in case, my head hurts fighting with this lol
So im trying to use the event tick to read input. Originally, i had thought i can only use one input mapping at a time, so i have an Actioned variable that the character sends to the vehicle, then the vehicle checks for the Actioned value if activated within the tick.
There’s quite a bit of functionality to activate the vehicle, as im adjusting different aspects of the vehicle, so keeping it away from the character bp would be preferable.
I noticed the inputs of the vehicle didnt work if it wasnt controlled, wouldve resorted to input triggers on the vehicle if so. Unless i can utilize inputs on an object without character control, not entirely sure.
True, I’ll have to look into it more once i get back to my computer. Had also thought about event dispatchers, seems it could be another possibile solution
Alright, looks like I was able to use event dispatchers in place of the tick event, much better alternative, thanks for pointing out the approach to input!
In regard to the event tick, it does seem that when spawned or placed with an ai controller, the event tick of the object will run, but if there is a possession change and the ai re-possesses the object, the ai controller will lose that tick. When looking into the documentation or other online posts, I can’t find anything that would indicate that the ai controller would lose the event tick after re-possession. Curious if there’s more to that, if that’s intended or not?
Well usually you don’t need to re assign the ai controller to the vehicle.
When you exit the vehicle and possessed your character, since the vehicle remove it player controller, it just move back to it default assigned AIController.
Make sure you created a new bp ai controller (even though i thk the default one should be working too) in your bp vehicle:
I just tested a simple event tick from the vehicle bp, i possessed the vehicle then possessed my character and still ticking.
Ah okay cool, yeah tested it and works, thanks! I looked further into it as well and realized i was wrong about the possession aspect of the issue. I’m not entirely sure what’s going on, but it has to do with the AVS vehicle and how it handles the tick. Testing with classes outside of that, the event tick works fine with no player control, I suppose i might have setup the vehicle controller for AVS incorrectly. Regardless, should resolve my concerns, thanks for helping out!
Found out the issue regarding the tick, the AVS component is setup to only tick during physics events, which explains a lot and led to my confusion for possession, so whenever the vehicle got dead-still, the tick would stop working. Pretty neat actually now that I understand it