Is it possible to toggle a single character pawn between the standard third person template and a physics based ball? Looking to switch between a capsule collider and a sphere without changing pawns and keeping the camera centered on both at the same time. Building this in version 4.27.2 if that helps.
Hey @Night-Melon how are you?
I think it is better to switch between two different characters than to change the character behavior and parameters itself. Here is a tutorial that I believe could help you a lot with that.
In addition, as you don’t want to have both characters at the same time in the same place, what you can do is to store the possessed character’s current location and rotation BEFORE swapping characters, and place the new character in that location and rotation after. Then you can move the unpossessed character out of the map. This is if you don’t want to destroy the characters when swapping for any reason.
Let me know if this helps you!
The Character class (First & Third person template) are built around using a capsule collision. This is coded in C++ and all the movement math is based on that shape. You cannot change the shape.
You can however hide or replace the skeletal mesh (Mannequin). Replacing is the better option, but requires toggling a lot of CMC’s settings. I’d also use an Actor Component to handle movement logic when you toggle to the ball.
Best overall solution is to spawn swap and possess 2 different pawns.
This is not how it’s supposed to work in Unreal Engine. You should put all the important shared logic in the PlayerController, and then switch between a Character (for third person) and a physical based Pawn (for the ball.)
You can easily destroy the Character and spawn the Pawn and Possess it in the same location in the same frame without a framerate hitch, that should Just Work ™. If you do this a lot, it might be easier to spawn both pawns at game beginning, and teleport/deactivate one of them to some hidden area when it’s not being used, and teleport/activate the other one that’s active to the current location.
I actually do exactly what the OP is looking to do in my current game.
it works quite well - I have a custom movement component (I haven’t switched to Mover yet, but would work just as well there)
When not in the Ball movement mode, it uses the capsule and all the normal movement code.
When in the ball movement mode, the capsule is disabled and effectively left behind, while the physics sphere is controlled by the custom movement mode.
The SKM gets attached to either the ball or the capsule, depending on which is active.
So far, works well for me
Should be noted, it’s a single player only game, so that makes it easier with the physics movement mode.
An example of what it looks like - I don’t have the collision rendering on, but in the debug spew you can kind of see what it’s doing
Thank you to everyone who answered! I got it working, but now I’m having trouble applying velocity to the ball. I’ve opened a new question here if anyone has any tips! Applying Character velocity to physics Pawn