Starting object at editor position and rotation...noob question.

Hello,

I’m new to Unreal, and I have created a simple actor class (from the examples in c++), but it always starts from position 0,0,0 and not the Editor position. I know how to set the position in code, but how do I make it use the Editor position from the start ?

Cheers…

When you play in the editor and select “Spawn Player at Current Camera Location” in the play options, the editor makes a special PlayerStart at that location of class PlayerStartPIE (PIE = Play In Editor). You can use that to your advantage by looking for all of type PlayerStartPIE, you will find exactly one which is the one at the camera position. You can then apply that actor’s rotation and location to your actor.

playerpie.png

Of course you won’t find a PlayerPIE if you don’t play from editor or if you select to spawn the player at the default player start.

@NisshokuFK - Thanks for you replay, but I don’t think I’ve explained myself correctly. I’ve created a c++ actor/object (basic cube shape and collision) and I’ve placed it in the scene. When I play, the object is spawned at 0,0,0. How do I make it use the Editor position. Is there a line of code I’ve missed ? I thought this would be automatic ?

Cheers…

I see, your actor is spawning at the wrong position. :slight_smile:

I think I understand what is going on. You are overriding the OnConstruction method, but forgetting to call Super::OnConstruction. Can you check that?

Thanks all for your replies. Seems to be an odd problem. As I’m using substeps, it seems that the very first subsetup and then using PhysX only API calls, my object is at default location.