Hello,
I’m trying to do something that seems simple – I want to generate X points at a distance of Y around a model (from its outer edges) evenly.
However, I ran into the issue that LineTrace doesn’t work from inside the model and ignores any collisions.
Is there an easy solution to this problem? I can’t believe there isn’t a simple way to work around this.
I’m trying to generate work positions around resource objects in my RTS game, where villagers will gather materials.
For example, I want to create 5 work positions evenly spaced around a tree at a 1-meter distance of tree trunk.
For a large, irregularly shaped rock, I might generate 15 positions scattered around it.
These positions should be stored in an array inside the Resource, so I can easily work with them later.
Can anyone please help me with that?
You can just trace from the outside in 
Get your list of vectors by rotating a unit vector around the pivot point. Then go out on each one until you must be outside the mesh, and trace back in.
2 Likes
You can get scene queries (like line traces) to work when doing them from inside to outside geometry. To do that you need to enable double sided geometry in your meshes in the static mesh editor.
That said, given that is a per asset setting and not something you an specify at runtime per query (therefore it will affect everything that uses that mesh),
I also recommend doing your queries from the Outside → In, instead like @ClockworkOcean said.
If you are working in UE 5.4 or UE 5.5, you can use the Chaos Visual Debugger to visualize and debug your queries (It might be useful while you develop your algorithm).
Here is a link to the user guide for the 5.5 version
2 Likes
Dont use line traces.
Look up the blackboard stuff, this is something that should be kept track of as part of the AI of the individual unit (villager?)
It’s hard to say what would work best in practice, but its probably best if you just define the positions for each object and then place or replace instances to blurpints at runtime to achieve the final result and get an instance with pre-assigned (and customized) spots…