I need to have foliage on a moving (animated) actor. Anyone have any thoughts on how to go about this? The foliage tool doesn’t work with skeletal meshes and I’ve tried to convert all instances to one static mesh object, but that doesn’t seem to work either.
Foliage isn’t dynamic like that, I’m afraid…
If it’s a small amount of foliage, you can just put the actual meshes on the actor and attach them.
If it’s a larger amount of foliage, you need to write a blueprint to instance the foliage and attach it to the actor.
Then it will move with the actor.
PS: If you want to know how to make your own foliage spawner, it’s not that bad, I can explain, but I’ll need to see the mesh first
If you could assist, that would be great. I’ve attached a pic of the mesh. It’s a crab, haha. I’ve spent so long on this, I might pull my hair out. It’s a pretty big amount of foliage I’m afraid. Lofty goals.
FOr a more indepth version of what I’m trying to do you can check out Opus Monumenti | The Rookies
Tell me if I left anything out, because I got logged out about 5 times… :-/
I just tested it, the grass moves with the actor…
And the rest in another comment, because AH doesn’t work.
Here’s the code ( also attached as notepad )
[link text][1]
Awesome! It works, but I’m not getting the same result. The only spawn in the box area and not on the mesh
Ok, it’s not pretty, but it works.
I made a spawning ‘plane’. It’s actually a flat box, because we’re not interested in the Z of the box.
It runs a loop ( number given by that param ), does that many downward traces to find the target mesh ( also a param, see pic 1 ).
You can have an array of meshes, and it takes one randomly for each go. I only used one, just to make the point. Fifty grass meshes on the lion:
When you’re done, you can convert them to hierarchical instances meshes, by clicking on them and choosing ‘merge actors’. You have to click on them in the list, not the actual meshes. They all have the same name, so it’s easy:
This option:
This is one ‘thing’ which you can attach to the target mesh and it will move with it etc.
Looking at your traces, I’d say you’re hitting the box. I have my box set to ‘overlap all’.
Also, this shouldn’t happen, because you’re checking that you’ve hit the target actor?
Can you show your code anyway?..
PS: Also:
It’s a skeletal mesh, is that an issue?
Ok, so yeah it’s the collision in the physics asset that’s the culprit. When I try to use complex collision as simple it doesn’t work however. If I re-generate bodies as convex hull it works though. Just not as accurate as the complex collision would.
Kinda, haha. I just have an issue where the physics mesh, if I set it to Use complex as simple, then there’s no collision. Just trying to figure that out now, but the core issue is solved.
Ah! - what is the collision on the crab?
I think maybe it has a huge simplex collision box. You probably need to set it to ‘use complex as simple’
What do you see when you look at the scene in collision mode?
Is the mesh still the same shape?
I think you have to set all the parts as ‘use complex’ in the physics mode.
So, it’s kinda working?