Download

Is it possible to paint or spawn in foliage that is rotated to point towards a certain point?

I am working on a game that will allow the player to interact with the surface of planets and the space around them. I have thought a lot about the different ways I could make space to ground system and I have come to settle on using true spherical meshes split into chunks as the terrain because it would make any transition to the ground far more natural than trying to switch to a flat level. The biggest issue I have run into so far has been the rotation of the foliage. I want the foliage to appear straight up relative to where it is on the sphere, but I don’t want it to poke out at odd angles from the terrain, so I can’t use the align to normals option. Is there any way to control the rotation of foliage when it is created, either by painting or using procedural foliage spawners, so that it will always point to a certain location (the center of the planet)?

You would have to loop through all the meshes and adjust rotation via a bluetolity script.
its not hard, just a bit of a nuisance.

Ok, I got a Blueprint Utility script made that can successfully rotate individual foliage static mesh instances, but now my issue is calculating a rotation so that the up vector of each foliage points away from the planet’s center point.

Just use the terrain normal for that… clicking align to surface option on the foliage should normally suffice

I don’t want to have plants poking straight out from individual terrain features because real plants grow straight up to get the most sun, so it wouldn’t look realistic. However, you did give me an idea. I will keep a perfect version of the sphere I base the planet terrain on and use its normals to calculate the foliage rotation.

Sounds like a good idea.

however note that the sun is only straight up on the equator
Plants tend to grow towards the sun. That would likely mean different angles based on which side of the eqator is getting more light during the sprout season of the plant. (Talking about small plants more than trees).

Realistically, if you align to surface normals you can usually barely tell the difference or notice it not looking as “natural”. Particulalry, if the plants aren’t static and move with wind displacement, their starting angle barely matters at all.

Obviously to an extent. If you have 2km with just 1 plant to look at, yes. You would probably be able to say… it looks off. ;p