How make option in blueprint actor to "snap" static mesh component to floor?

Hello Guys !

The question is quite simple, but i´m not figure out how do this: How i make option in blueprint actor to “snap” static mesh to floor?

Let´s say i have this blueprint actor called “Door” with a static mesh added in components tab… How i create one checkbox to simple left click in the “Details” blueprint , on viewport, to snap the static mesh to floor ? Or how i execute “end” command snap via BP?

This blueprint actor “Door” is already placed in my level. But, i need to place around 300 of this “Door”, and click and select all 300 meshes and snap to floor, one-by-one…this is a nightmare…

I´m using UE 4.8.3…

Any ideas?

So…any shot? I´m stuck on this, and the documentation for this is very, very basic.

Updating this :smiley:

Still try to figure out how do this stuff…Epic need to do some manual for these simple things…The engine is powerfull, but the documentation and wiki fail on this little things :confused:

What i found until now is:

“Snaps a value to the nearest grid multiple. E.g., Location = 5.1, GridSize = 10.0 : return value = 10.0 If GridSize is 0 Location is returned if GridSize is very small precision issues may occur.”

Target is Kismet Math Library

You can do a line trace to the floor, then use the HitActor’s Z location for your actor.

When I just tried this, the object (basic cube) disappeared half into the ground. This happens because the cube’s pivot is placed at its center. If this happens, the easiest fix is probably to either adjust the mesh itself in whatever tool is used to model the meshes and move its pivot to the floor, or you could move the mesh a bit upwards in the actor viewport.

I do it following your example, but for some reason it´s stop on ? Is Valid:

Means the trace doesn’t hit anything. It might be hard to see in my screenshot, but it’s important the Z value linked into the Line Trace’s Start input hook is greater than the one Z value linked into the End hook. So the trace shoots from (above) your object to below the floor.

Just how high above the ground is your door placed? You could try increasing the second value passed into the Minus node.

Alternatively, the floor gets ignored by the Trace check. This should work for both StaticMeshes or Landscape. Does it have collision? What are its Collision Presets settings in the Details panel?

It´s not only a door, it´s a *Blueprint Door. A static mesh “door” in the blueprint actor with collision preset “auto convex” auto generated by UE4.

And the blueprint is placed in the level few centimeters above ground, nothing so fancy…If i place the blueprint in the level and hit “end” (FIN) manually, works fine…

And yes, i see the connection from “Z” from actor location to make vector to line trace … i did same thing in my blueprint

Question: I set one node from my construction script direct to “line trace by channel”. It´s affect the whole thing in some way? And how setup a reference to my blueprint actor in the node “set actor location” if the “actor” is a Blueprint ? I try to get “Root” component of blueprint to connect on get actor location, but no make difference.

here my setup:

If the trace doesn’t hit anything in the first place, then the problem lies either with the trace settings (which look okay to me) or the ground. You could try setting the Draw Debug Type to For Duration to see if the trace fires properly through your Door actor and into the ground.

Also, could you post the Collision Presets for your ground object (StaticMesh or Landscape, presumably)? You can find them in the Details panel in the editor viewport. I’ve attached an example screenshot:

Hey, that´s it! Worked very well. I guess did not work before because my floor (box brush) don´t have any collision! I added one blocking volume and change collision to “blockall” and… Eureka!

Thanks alot , @ !