I’ve created a custom C++ PlayerController. On that player controller, I attach a custom C++ USceneComponent (although not customized yet). I attach the USceneComponent to the PlayerController in the latter’s constructor thusly:
SelectorComponent = CreateDefaultSubobject<USelector>("Player 1 Selector"); if (SelectorComponent) SelectorComponent->SetupAttachment(GetRootComponent(), FName(TEXT("Selecty Bit")));
… having read the documentation, this should default to the attachment in the relative mode. Later, I’m trying to select another SceneComponent and to understand that, I’ve pulled some of the debut code out of the engine … which, at the bottom, runs DrawDebugCapsule().
Now… I could detail the arguments for that, but they’re based on calls to GetComponentLocation(), GetComponentRotation() and a float added to those for the far end.
When I test this, it seems that the DrawDebugCapsule() is stuck with where the PlayerController spawnned (where it was when I hit the Unreal “Start” button) and not the current position of the camera it affords.
Do I need to just take the relative location of the camera (boom) ?
Does the player controller move, or is my attachment wrong?
Isn’t the PlayerController an Actor? I’ve seen examples of this type of attachment on an Actor or Character (also an Actor), but I don’t want any of the Character behaviour.
Do I need another Actor in addition to the PlayerController for this purpose?
To clarify, the “player” is etherial here — no body, no hands, etc. They are controlling items (thus the need to select). The camera movement I’ve gotten from the PlayerController by itself is excellent (almost identical to, say, subnautica … wasd + c (down) and (up) + mouse look when buttons pressed. Perfect. Now just need to select an move pieces. I feel like I’m close.