# How to spawn my object on ground level

I’ve seen other people post similar questions, and the answer is always creating a line trace to the ground, and spawn where the line breaks. I’ve looked around, and I’m having a hard time understanding line traces, could someone help me? I’ve attached a picture of my nodes.

The idea behind a lone trace is to find any objects between any two points in 3d world space. You provide a starting location somewhere in 3d world space and an end location in 3d world space. (Note: lone traces always occur in world space to the best of my knowledge). With the given points the engine searches along the lone between the two points checking for objects intersect with the line between the two points.

In your situation you would start with a given location, in this instance 200 units in front of your actor location and sufficiently high to make sure you are above the ground in z. This is the start location of the trace. Then you would define a second point directly below the start point say a 1000 units down in z. This is the end location of the trace. With these two points you can select the appropriate trascfe channel and find any objects along lone between the two points by calling the TraceLine node.

Trace channels are where alot of problems tend to occur. When you create an actors collision or it’s mesh component you generally set up what kind of object it is, such as world static, world dynamic, physic actor, etc. Each type of object has a set of collision settings they respond to. These determine what trace channels they respond to and how the respond. Almost every object responds to visibility. And if you need to know if any kind of object is between the two points, this is typically the channel that is traced. If you need to know if a specific kind of object is between the two points then you’d select a channel specific to that type of object.

In your situation, I’d guess you want to of any kind of object between the two points and visibility would be the channel you’d select to trace on.

The result returned by TraceLine will provide information on objects between the two points. The hit location is what you want to get and use as the location for the SpawnActorFrpmClass node’s transform location.

You sir, are a lifesaver. Really good explanation. I definitely learned something. My stairs are working just as i wanted. Thank you so much.

You’re welcome

so basically… trace a line from some point to same point with z=0… when the hits happens, it is the ground… right?