I’m trying to make it so that my character can continuously walk through a destructible object - kicking the chunks away.
I have the destruction of the mesh etc. all set up via a hit event, and it works fine. My main issue is that the character gets stuck on the pieces and sometimes gets forced in to the air.
What I want to happen, is that the character destroys the destructible and walks through the debris whilst pushing it / kicking it aside. Essentially, I want the character to collide with the debris and not react to it.
They are both set to block each other. I assumed the issue was the capsule being pushed, but ignoring the capsule means no collision at all.
originally I got past this with only using trigger overlaps to cause the destruction, but I need to use hit events in order to split the struct for glancing angles.
Okay, it seems setting the large chunk threshold to a high number alleviated the issue a fair amount, but there is still an initial second where the character stops in his tracks before continuing through the debris - adding spheres in front of the character does not help this. They appear to ignore the destructible completely, and if I set hit events to true - the destructible appear to just start using impact damage instead of using the blueprint (different issue with post HERE)
I am using 4.6.1
Any help would be greatly appreciated.
I am new to UE4 myself and so don’t know exactly how to do this in UE4 but have lots of experience in physics simulation & PhysX.
The problem you have is that, I suspect, your character controller is not driven by forces and thus does not have an accurate idea of velocity. Due to this the collision resolution between the character controller and the rigidbody pieces is never going to look correct. To fix it you have a few possibilities:
- Forcefield method
Place a forcefield around your character’s feet which applies forces to chunks which intersect the force field’s sphere. If you scale it on distance then they should knock out of the way quite neatly. This is simply a sphere trigger, which checks for overlap, and when overlapping applies the force.
This can go wrong in enclosed areas where you can’t push the rigidbody out of the way, but you are still intersecting it.
- Remove collision between player and chunks
This is probably the neatest / easiest method and what I would go with. You simply place them in different physics layers and remove intersections between them. If you are 1st person then this is probably going to be fine.
Note you could use this and the force field method together which will probably give you what you want.
- Drive your character using forces / velocity / torque / angular etc
This is going to be more gnarly and will lead to control of the character become more spongy / laggy when in contact with the pieces. I am currently struggling with pawns / player controllers etc so not sure how easy it is to do in Unreal.
The algorithm for doing it though is fairly simple, depending on what sort of character control you are looking for. It is usually something like
if(velocity.magnitude < topspeed)
addForce(throttle * direction)
- Physically simulate the walking human using inverse dynamics
Would give incredible realism and probably earn you a PhD!
Thanks, I’ve alleviated most of the issue with the “large chunk threshold” but there is still an initial delay where the character stops.
I tried added a couple spheres that ignore everything and block destructible and added them slightly in front of the character but it hasn’t changed anything…the spheres seem to completely ignore the destructible until they are chunks.
Thanks for your reply.
I have marked this as solved, since I believe the issue lies elsewhere, and have a question set for what I believe is a bug.