I have a class inheriting ACharacter but I would like the default CapsuleComponent to be moved half it’s height up such that it doesn’t get stuck when it’s spawned directly on the ground. Now it’s placed half through the ground.
I know you just could use some code to move it up a bit but I would like to add the offset by default in the actor’s components. I tried to add a SceneComponent as root and then some offset to next component. However that didn’t work since the CharacterMovementComponent can only update a PrimitiveComponent and not a SceneComponent.
How should this issue be solved? Also when I try to move the USkeletalMeshComponent in blueprints the editor crashes when I compile the blueprint.
This issue is being caused by the fact that the CapsuleComponent is providing the collision information for your character, including where it is standing on the ground. If you move the CapsuleComponent up and do not move the mesh the same amount, then you will see the effect that you are noticing. If the mesh is correctly set as a child of the ROOT CapsuleComponent, this will happen automatically.
If you are having trouble with the character’s CapsuleComponent being stuck in the ground when the character is spawned, the “simple” solution would be to raise the spawn location slightly.
I am not sure what you are referring to in regards to the crash you mention with a SkeletonComponent in your Blueprint. What Blueprint are you putting the SkeletonComponent in?
Sorry, I mean USkeletalMeshComponent not SkeletonComponent. The question is a bit poor formulated so I will try to clarify it a bit.
I mean since the root component’s location is the actor’s location. I tried to add a SceneComponent as root node to place the CapsuleComponent such that it stands on origo instead of having it’s middle there (in the “blueprint space”). The CapsuleComponent needs to be moved half its height up to match the mesh. My mesh is at the correct location but if I try to move or rotate it in the derived blueprint, the editor crashes once the blueprint is compiled.
“In game” I get a position by raycasting the player’s cursor and then want to spawn units (derived from this class) of all different sizes at that position. Therefore I thought it would be convenient to being able to use that returned location from the raycasting to the ground to immediately place actors correctly without any further corrections.