I’ve added multiple blocking collision cylinders with a different translation to horse pawn actor and it appeared that foliage becomes glitchy while colliding with it. Instead of bending foliage away, it gets attracted to the front cylinder. Any ideas how to fix it?
Here’s the code of these additional cylinders, they are all same
Cant help with that, but there are quite some talented coders here so you will get there.Meanwhile i wanted to ask if those are the gamecube assets?
Cooking some nice mode there?
I would suspect that the problem is with the shader. I assume that you’re using this setup? Does the same thing happen when Link walks through that grass?
Yes, it’s based on this example, but I have changed most of it. There were no problems with any other actors.
Perhaps, foliage just wasn’t meant to be used with actors having collision components with non-zero translation.
Cylinders can’t rotate. Basically, everything will collide as a world aligned box when it moves, unless it has rigid body physics. I’ll have to add multiple components of it and it will lead to this bug again. Oh, and rigid bodies have no effect on foliage
I just thought of some crazy hacks that might work, or they might not.
Hack #1: Give your collision cylinders a negative radius. This might flip the direction that the grass gets pushed, but more likely it’ll just break a bunch of stuff or won’t compile.
Hack #2: Make the grass respond to wind instead of collision. Attach a wind source actor to your pawns. Instead of using sine-wave deflection for your wind shader, make it do what the interactive foliage would have done. If you have both wind and interactive foliage, then give your hacky pawn-based wind sources some really unusual wind speed (like negative, or a really high number), and put an if node to check to see if the wind has that exact unusual speed, and if so, then switch to collision mode. Does that make sense?
Edit: Of course, you could always just use a single collision cylinder. You might consider setting the horse’s origin to under the front feet. Or you could have the origin in the middle of all 4 feet, and just adjust the cylinder to find the right balance of pushing stuff away as far as possible to the front and back, without pushing too far to the side.
That way collision with foliage even works when the horse just turns around. But… these dummies don’t block player. Turning on BlockActors in cylinder component make them collide with the base and they begin move around it, even though bHardAttach is enabled. Is it possible to keep them on the same location relatively to the base while keeping BlockActors on?