I would like to have Blueprints that, when I place them in the Viewport, the automatically adjust once to snap to the floor. I don’t need them to snap on every time I move them, just on the initial drag and drop.
The default PlayerStart and Character blueprints do this, and if you create a child class from those it works the way I described it. Their pivot point is at the center, but it still moves the asset up the size of the collision capsule and places it nicely on the floor.
If I create a child blueprint of Actor or Pawn and add a Collision Capsule as the DefaultRoot, it only places the asset on the pivot point. I know about the “END” key but it would save some time when adding a lot of assets to not have to “lift” them up all the time and then press “END” key.
To Reproduce:
Create 1 child blueprint of PlayerStart and drag it onto the scene. It will align with the bottom of the collision capsule.
Create 1 child blueprint of Actor, add a Collision capsule and set it as root. Set the half hight to 90 and radius to 44. Drag it onto the viewport and it will align on the pivot point and not on the bottom of the collision capsule.
In the image, left is child BP of Actor. Right is child of PlayerStart. Dragged from Content Browser and released.
You can, but you shouldnt.
Meaning that its an On Creation event, and running line traces during the process to find a floor value is silly.
The home button/or end I guess? Uses the actual object collision and will work on anything that has a collision.
It should however work on all objects you have selected (so you can select all the object in the list of items, drag them all up, and hit end to have them fall down).
If you really want to force the OnCreating pathway, then you end up with objects which cannot be placed anywhere if not on a floor.
The editor will run oncreating any time the object is moved, rotated, shifted, etc.
Making simple taks no longer possible (moving an object up off the floor).
If thats what you want, then by all means, create the event and code up whatever you think appropriate to position the object.
I’d reccomend a simple sweep off the object’s own collision.
Perhaps a better alternative to all of this would be to temporarily simulate physics, let all objects fall, and save up their final locations onto the level… I find the end result more realistics generally speaking.
For the Physics solution, yes that makes a lot of sense for scrambling around assets.
I just don’t understand how the Character and PlayerStart has this hidden logic that works so well for placing stuff in the editor the first time. It creates a nice experience so I’m just trying to find out how Epic is doing that.
I was looking at changing the construction setting by setting on drag to false. But it was just inconsistent.
This behavior is implemented in class ANavigationObjectBase in the functions ShouldBeBased and FindBase.
Unfortunately, this class is NotBlueprintable so you can’t really use it as-is from blueprints yourself.
The logic is roughly “there has to be a world and I can’t be in water and I must actually have a collision capsule, and the world can’t have HasBegunPlay()”
It actually only sweeps up to four times the size of the capsule half-height, it doesn’t sweep forever, so you CAN make a player spawner that spawns in the air.
Although this is from a quick read of the code, I haven’t stepped through it to verify runtime behavior.
Thank you for the answer. I found that code too, but only the PlayerStart inherited from that one.
Granted I’ve noticed that PlayerStart and Character behave slightly different. PlayerStart is constantly being on top of the level floor “world static”, but if you keep it in the air it just stays there as it is.
But Character, no matter where you release it, it always gets bumped the first time.
Hmm kind of. I think that only changes the sprite. Because if you lower the start into the floor, it is marked as “Bad”.
The validate function is called by PostEditMove but it only moves it once and then it moves it back to the original position. So I also had trouble figuring out what the intention is for that other than changing the sprite NavigationObjectBase.cpp#L206-L215
The Validate function is not always called either, since it’s called when bFinished is true. I’m basing this on the fact that I’m not constantly seeing the log
[“PostEditMove Clear paths rebuilt”](https://github.com/EpicGames/UnrealEngine/blob/5.3/Engine/Source/Runtime/Engine/Private/NavigationObjectBase.cpp#L101]
that’s supposed to happen when that is true, along with the call to the validate function. At least I’m not seeing it as frequent as a “Print Hello” in the construction script
Yeah it could be a oneoff, but I would like to try and see if it can be applied to my own blueprints because it would be very nice not to have to change pivot points.
Not sure if it has anything to do with PIE. PIE is just Play In editor but it’s not when I press play, it’s when placing stuff in the viewport on after dragging from the content browser.
The Geometry tool fox Box works the same way but again, can’t find anything on how that works.