Vehicle/Foliage Interaction

So I have a four-legged scarab-esque vehicle that consists of 9 static meshes that animate in unison using interp/set location/rotation methods. The vehicle has come out better than I could have ever expected, but I have been struggling to get a proper system in place that allows it to dynamically interact with any trees it collides with.

Currently the vehicle traces a sphere around itself, detects static foliage instances, deletes them, replaces them with an actor, and copies the static mesh and world transform of the tree it is replacing. This works perfectly, but the actual interaction between vehicle and tree is what I’ve really been struggling with.

Originally, the actor had a static scene component positioned just under the ground, which was physics constrained to the tree static mesh, locking X, Y, Z positions and Z rotation, with free rotation on both the X and Y axes. As the vehicle collided with the trees, they would rotate around this pivot mostly as expected, but due to the way physics in UE4 works right now, they would inevitably jitter like crazy, and sometimes detach completely from their physics constraints. This totally destroyed the sense of immersion that this system was intended to create.

I should also add that turning these trees into skeletal meshes is out of the picture in this case.

So I’m thinking that instead of using physics, I could drive the rotation of the trees manually during overlap events, but this is also turning out to be pretty difficult in a mathematical sense. Due to the fact that each leg is moving individually from one another, they could be colliding with the tree at virtually any angle.

So, I’m wondering if anyone knows of any ways that I could either:

1- Stop the tree physics from freaking out (I have already played with angular/linear damping, projection, velocity limitation, and solver iterations, but to no avail thus far) or,

2- Rotate the trees manually based on the location at which they are impacted by the vehicle

I would be so grateful for any help, this has become a major headache!

I was able to “somewhat” fix this problem by limiting angular velocity with the “Max Angular Velocity” setting under the Physics section of my physics component’s detail window, coupled with some extensive tweaking of angular/linear damping and setting the center of mass offset under the ground linearly on the Z axis. Also, I added a box collision towards the tip of the tree that OnEventHit casts to the landscape, and then sets simulate physics to off when the cast returns true (which is a bit better for performance and fixes instability when colliding with the landscape). Lastly, I set up a OnEventHit that casts to the vehicle, and on success delays for a fraction of a second and then forces the physics body to sleep, which is also a bit better for performance and helps stabilize the physics slightly. Definitely not perfect, or the solution I was looking for, but I guess it will do for now until a better solution comes along.

I will wait to mark this comment as the answer to my question for a few days to see if anyone might come up with a better solution. Any input at all would be greatly appreciated guys!