Hello,
I am creating a spline tool, with instanced static meshes, where it is possible to randomize the population of different kinds of meshes from a user set array[1]. To make it easier to use, I want to provide the option to snap the meshes to the landscape.
This works great for when there is only have one type of mesh, but when I have multiple types of meshes, this doesn’t seem to work the same way.
How can I snap different instanced static meshes to the landscape?
I will share some screenshots of my blueprint and the problem. So hopefully someone will understand what I mean. The screenshots are in the correct order for when the function runs/gets called.
Where I ‘see’ if the amount of meshes is only 1 or more:
Adding one instanced static mesh component for each type of mesh in the array “Meshes”:
Adding instances and setting the static mesh. When that’s done, I am calling the “SnapMeshesToLandscape” function:
You can find the “SnapMeshesToLandscape” function here:
Snap Instanced Static Mesh Spline To Landscape posted by viimi | blueprintUE | PasteBin For Unreal Engine
Screenshots of the SnapMeshesToLandscape function
“SnapMeshesToLandscape” function; Getting the array of all instanced static meshes I have added:
“SnapMeshesToLandscape” function; updating the transform from where a line trace hit the landscape:
I skipped the line trace screenshots, but you can find the whole function in the link.
Screenshots of meshes snapping to landscape
How it looks like with one type of mesh (how I want it to work):
How it looks like with multiple meshes:
I almost sure I am doing something wrong when I set the InstancedStaticMeshesAdded array, but I don’t know what.
Note: I will make this to an utility widget blueprint later on, but now I just want the functionality to work.
The “user populated array” I am talking about. it actually a Map right now. ↩︎