I’d like to change the default capsule collision component on ACharacter when my third person character goes to the prone state.
To make it work properly I need to swap out the root component which serves as the collision volume (in this case, the capsule component).
Using blueprints and inheriting from ACharacter I can’t access the method “setRootComponent()” that is defined in the “grand”-parent class AActor
(AActor → APawn → ACharacter → My current blueprint) because it is protected.
I tried to subclass ACharacter, but even then I’m not able to call “setRootComponent()” as it is protected in AActor.
How can I set the root component or assign my new collision component as the root component directly in blueprint when my character goes to a prone state without having to subclass AActor and make the function “setRootComponent()” public?
Im not sure if this is correct but I believe you can set components that are protected and used as defaults by passing values in the Super(ObjectInitializer) section. However if so then you need to specifically see what you need to access. I would usually do this with a vehicle movement component as such.
The UVehicleMovementComponent10W would be my custom component (in your case the collision capsule component) and the VehicleMovementComponentName would be an FName type.
This let’s me over-ride the default component which only allows for 4wheeled vehicles so I can do some magic
Hi, thanks for your answer! What I basically want to do is expose the “setRootComponent()” to Blueprints to swap out multiple collision components based on the current state of my third person character (standing, prone etc). You suggest setting the root component when initializing my custom ACharacter subclass, if I’m right but how could I set the root component during runtime?