Line Trace by Channel help please (blueprint)?
Here is my dilemma.
This would currently work as it is if the Landscape was flat, but of course it isn't so what I need is the ability for each mesh to do a Line Trace By Channel to check the Landscape's floor height and snap to that when spawning the individual meshes. I have created a custom Channel called Landscape and attempted to do some of the blueprint myself but I'm struggling with getting the hit location and using that to generate the Z value and turn that into the height information for the individual meshes.
If someone could show me a simple, complete usage of this it will hopefully give me enough clues to integrate something similar into my current blueprint. or if more info is needed I could share what I currently have in my Construction Blueprint for the meshes and you could tell me where I'm going wrong.
Thanks in advance, this'll help me TONS.
asked Dec 05 '14 at 05:12 PM in Blueprint Scripting
If you create a custom Trace Channel called Landscape, with the default set to Ignore, and then adjust the collision on your landscape to block the Landscape Trace Channel, you can set up something like this in your Actor BPs:
What this does is get the Actor's location and the difference between that and a point straight down. I have the default for the variable TraceLength set at 0,0,1000, but you may need a longer trace depending on how high above the landscape you're spawning your Actor. The Trace Channel is set to Landscape, so it will only detect Actors with Landscape set to Block.
Then it takes the Out Hit and gets the location of that hit, and sets the Actor Location to that point. If you're rotating your Actor randomly, you may need to add a Z offset to this depending on the where the pivot point is in relation to the mesh.
Hope that helps!
answered Dec 05 '14 at 10:48 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here