[PCG] Rotate spawned mesh towards spline/points

Hi,

I am currently trying out PCG and experimenting. I’m trying to figure out a way to turn spawned static meshes towards a spline or towards the closest point, but I cannot figure out how. Anybody here knows if it is possible and if, how?

You can see in my image what I want to do.

Sorry for digging out such an old topic, but did you by anyc chance solved this puzzle? :smiley:

Hi, no worries! I actually managed to find the solution but I forgot to post it. I will dig in the repo and try to find it :slight_smile: PCG has come a long way since I did this initially, so there might be a better way to do it now, but I’ll find the PCG graph and post it here in a few days.

Would appreciate this! I tried this method but I’m too inexperienced in PCG :V

I tried this method too, and some of my stuff is inspired by it.

This is how I managed to get this done in 5.3.

Remember, my solution is an early version of the PCG stuff, it was made in 5.3 when lots of nodes were not yet available.

I uploaded all the PCG and BP stuff related to it here:

BP_PCGGenerator: BP PCGGenerator posted by SeanDSandland | blueprintUE | PasteBin For Unreal Engine
BP_SplineRoadGeneration: BP Spline Road Generation posted by SeanDSandland | blueprintUE | PasteBin For Unreal Engine
PCG_Foliage: PCG Foliage posted by SeanDSandland | blueprintUE | PasteBin For Unreal Engine
PCG_Buildings: PCG Buildings posted by SeanDSandland | blueprintUE | PasteBin For Unreal Engine
PCG_Road: PCG Road posted by SeanDSandland | blueprintUE | PasteBin For Unreal Engine
PCG_Generation (Main root setup): PCG Main Root Setup posted by SeanDSandland | blueprintUE | PasteBin For Unreal Engine

Important functions within PCG_Buildings:
PCG_LookAt (Point Loop Body): PCG LookAt (Point Loop Body) posted by SeanDSandland | blueprintUE | PasteBin For Unreal Engine
PCG_LookAt (Execute With Context): PCG LookAt (Execute With Context) posted by SeanDSandland | blueprintUE | PasteBin For Unreal Engine

This look at functions are placed within a PCG Blueprint Component which looks like this:

Here you can also see the graph infront of that specific node within the PCG_Buildings:

If there are other functions you want to take a look at to get better understanding with this system, just tell me which one and I’ll upload those as well.

I hope this helps!

1 Like

Wow, thanks for sharing your solution! This would take me ages to figue out on my own. :sweat_smile:

No worries! Happy to help, it was tricky to figure out for sure :sweat_smile: It was also my first time stepping into PCG and there were very little resources on the topic. I should probably make a video on this. I think the only thing you need from this graph is the BPCG Look At node setup, but take a look and reach out if you have questions :slight_smile:

1 Like