I am trying to find a different way to possessing anther Actor, E.G car. the trouble is when I just use the possess node I can’t access the rest of the player setup such as the inventory, also, the player just teleports to the location where i exit the car, so there is a delay as the camera seems to go back to the original location them teapots to the new location.
You can Disable Input in the character, and Enable Input in the car when gets into the car, and vice versa when you get out.
You could make the inventory an actor component. Then you can offer it in both the player and the car ( assuming it stores data in the save game or game instance ).
You could attach event dispatchers to your players movement input, and bind them to your cars input controls when the player is in it
Put Inventory in the PlayerState class.
Enter Vehicle:
- Disable the characters movement component (Movement Mode: none)
- Disable the characters capsule component (No Collision)
- Disable the Characters mesh collision (No Collision)
- Hide the Mesh and any other mesh components (rendering → hidden in game: true)
- Attach character to the vehicle (Actor to Actor)
- Unpossess Character → Possess Vehicle
Exit Vehicle:
- Detach Character
- Teleport character to Exit location (next to the corresponding vehicle door).
- Enable the characters capsule component
- Enable the Characters mesh collision
- Enable the characters movement component (Movement Mode: Walking)
- UnHide the Mesh and any other mesh components (rendering → hidden in game: False)
- Unpossess Vehicle → Possess Character
You could alternatively attach the character to a seat (Driver/Passenger) and set the characters pose. Still need to disable movement, capsule and mesh collisions.
edit:
You could teleport the character to the vehicle exit location. BUT you have to be cognizant of Netcull distance and destroy actor behaviors when the character is no longer relevant to the replication subsystem.
If the vehicle gets too far from the character the client will destroy the character. As will the server (if multiplayer).
All very good solutions thanks to all. I forgot about the player state BP, I will play around with it. also i will see it also hold the camera component as well, it is a top down camera, i played around with the camera manager but i didn’t really like it
thanks