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

**URL:** <https://forums.unrealengine.com/t/c-pawn-doesnt-drop-to-drag-location-in-editor-root-doesnt-move-with-components/410554>\
**Category:** C++\
**Tags:** drag-and-drop, attach-to-component, root-component, unreal-engine, transform, CPP, question\
**Created:** [November 25, 2017, 11:20am UTC](https://forums.unrealengine.com/t/c-pawn-doesnt-drop-to-drag-location-in-editor-root-doesnt-move-with-components/410554 "2017-11-25T11:20:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_c1fc4d27](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c1fc4d27](https://forums.unrealengine.com/u/anonymous_user_c1fc4d27)\
**Post date:** [November 25, 2017, 11:20am UTC](https://forums.unrealengine.com/t/c-pawn-doesnt-drop-to-drag-location-in-editor-root-doesnt-move-with-components/410554/1 "2017-11-25T11:20:34Z")

</div>

* * *

## 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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/5/7/5573c92640c50ca0029da93d80f9d30ce9285a11.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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/c/b6c292ff4c91f3f14b62582d142c9a4d6d4452c0.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!** _

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c1fc4d27](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c1fc4d27](https://forums.unrealengine.com/u/anonymous_user_c1fc4d27)\
**Post date:** [November 28, 2017, 7:25am UTC](https://forums.unrealengine.com/t/c-pawn-doesnt-drop-to-drag-location-in-editor-root-doesnt-move-with-components/410554/2 "2017-11-28T07:25:46Z")

</div>

bumpedy bump bump

---

<div class="post-metadata">

**Author:** ![Chwindor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chwindor](https://forums.unrealengine.com/u/Chwindor)\
**Post date:** [November 28, 2017, 8:36am UTC](https://forums.unrealengine.com/t/c-pawn-doesnt-drop-to-drag-location-in-editor-root-doesnt-move-with-components/410554/3 "2017-11-28T08:36:45Z")

</div>

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.
