C++ Pawn Doesn't Drop to Drag Location in Editor & Root Doesn't Move with Components


I didn’t know how to properly express this in words, so I created a couple gifs of my issues. Basically, I created a C++ Pawn class, gave it a root component and a capsule component, then attached the capsule to the root.


Now when I try to drag and drop this C++ class to a specific location in the editor, it jumps to a random location (doesn’t seem to default to the same location every time; it’s always random)


221424-ept-issue-001.gif


That’s the first issue.

My second issue is rather annoying, but I somewhat understand what is happening. If I change the transform location of the capsule component, the root component stays put (since the capsule is a child of the root obviously); only when I move the root component or entire class itself, does everything move in-sync. I would like to make it so that no matter what I’m affecting (as I may, sometime down the road, have a child selected and not realize it) everything moves in unison (i.e. “glued together”) (or even to hide the transform widget, physics options, etc for everything except the root) would be awesome!


221425-ept-issue-002.gif


Here’s the code excerpt from my .cpp file:

/* PLAYER SCENE ROOT */
PlayerRoot = CreateDefaultSubobject<USceneComponent>(TEXT("Player Root"));
RootComponent = PlayerRoot;

/* COLLISION */
ColCapsule = CreateDefaultSubobject<UCapsuleComponent>(TEXT("Capsule Collider"));
ColCapsule->AttachToComponent(PlayerRoot, FAttachmentTransformRules::SnapToTargetNotIncludingScale);

Cheers!

Is there some reason that you use FAttachmentTransformRules::SnapToTargetNotIncludingScale? I have not test it but I think that’s why your component behave like this.

bumpedy bump bump