x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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. alt text

Product Version: UE 4.17
Tags:
nodes.png (208.7 kB)
more ▼

asked Sep 03 '17 at 10:16 PM in Blueprint Scripting

avatar image

Wolf20122012
3 1 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Sep 04 '17 at 06:27 AM

avatar image

cmarston74
296 6 7 10

avatar image Wolf20122012 Sep 04 '17 at 02:35 PM

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

avatar image cmarston74 Sep 04 '17 at 07:03 PM

You're welcome

avatar image leofucci Mar 15 '19 at 07:51 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question