I’m relatively new to Unreal, I’ve been using it for prototypes for about 12 months. I’m making a top down game with a few dozen physics objects active at any time, and a character that walks freely around the world.
How can I make the physics objects treat the player character like a solid object, but make the player character totally unimpeded by them?
Example 1, a ball should bounce off the player character as if they were a solid wall.
Example 2, the player character should be able to run through a stack of crates without even slowing down; the crates should disperse with natural forces from the collision
So I managed to solve this myself. Please any experts still let me know if there is a better way.
Add a second, slightly larger capsule as a child of the main player capsule
Configure its collision presets to ignore world static, camera, visibility. This way the base capsule is still responsible for static world collision, and the second capsule doesn’t capture the camera spring arm
Configure the collision presets on the base capsule component to ignore world dynamic objects and physics bodies
The player character can now run around freely, and other physics objects will be pushed away on contact. Here is a video of gameplay: https://youtu.be/4Wn0cuwkBn8
PusherCapsule is a slightly larger duplicate of CapsuleComponent, with CapsuleComponent as a parent.
I’ve added an additional capsule that is slightly larger than the player capsule. This allows the player to move around and push larger objects exactly as I liked, but smaller objects make him totally wig out and teleport around.
I’m not sure what causes this to happen, but it seems to be when they get stuck underneath his capsule. He can teleport up to a few feet in random directions when it happens. I’ll see if i can make a video.
Hey! Thank you for this, the capsule solution is actually exactly the solution I came up with myself about an hour after I posted the question. I did submit it as an answer, but it seems to have gotten stuck in limbo “waiting for moderation”.
It works great, but has a side effect that when you sandwich a physics object up against a solid wall, it teleports through the player character.
I didn’t know about the CharacterMovement component’s push force properties at all. I’ll play around with those tonight, maybe there’s a winning combination of settings in there to get this perfect without that one side effect.