Let’s start by creating a new function, which will contain the whole process (you are free to apply the exact same principles as Events or any other set up). Let’s call it MyPointCloudFunction.
Once the function is ready, add a local variable and call it MyPoints. Set the type of this variable to Point Cloud Point and convert it to an array by right-clicking on the blue bar symbol to the left of the name. This array will hold our intermediate data.
Now we can proceed to build the actual process, starting with populating our newly created array. For the purpose of this example, the array will be injected with 1000 randomly positioned, red points.
Once we have our data ready, we can create a new Point Cloud object from it, and it’s as simple as:
Note the Use Async parameter - scroll to the bottom of the page to learn more.
At this point you can do with the asset as you would with one imported through the Content Browser. In this example, we'll create a new Point Cloud Actor and assign our asset to it.
And that’s it - once the code or Blueprint is executed you should have a brand new, sphere-shaped, red Point Cloud, like this:
Here are the full code snippet and full-sized Blueprint screenshot of the complete process.
If enabled, the creation process will happen in the background, without blocking the main thread. This could be especially useful if you are creating an asset from a large data set (few million points or more).
If using C++, the approach is slightly different:
Unfortunately, I have yet to find a robust and easy way to assign Progress and Completion callbacks via Blueprint.