Download

How to remove Character physical interactions

I have a Character (the player) and an WheeledVehicle (AI controlled). Everything is ok, but when the Character touches the Vehicle and walks towards it, the vehicle moves. It’s not realist.
By the way, I tested with a Cube instead of the WheeledVehicle, but I got the same results.
From what I’ve noticed, there’s no point in changing the vehicle’s mass. Whenever the player pushes the car (especially around the corners), it moves, and sometimes, when the player jumps leaning against the car, the car goes flying.

What can I do to avoid this weird situations?
Do I have some way to disable Character interaction with physical actors?

UCharacterMovementComponent has a property that lets you disable all physics interactions, but you probably don’t want that. I recommend you override the ApplyImpactPhysicsForces on the CharacterMovementComponent, to make it not apply forces on cars. Now, you will need to have a custom MovementComponent, but that’s probably not that hard to implement.

1 Like

Also, I recommend turning off velocity imparting in the UCharacterMovementComponent if possible. It can cause glitches like these. Keep in mind though that if you turn it off, the character will no longer receive the velocity of the base it is standing. So if you are standing on the car, and the car starts to move, the player won’t stay on top of the car.

1 Like

The default character movement component is not physically simulated; it is a purely forward-kinematic object. It works great for many fun kinds of gameplay, but it’s not something that will interact realistically with a physically-simulated world.

If you believe physical interaction would be more fun in your game, the best way to get there, is to build your own movement component, perhaps still based on a capsule that is locked to being upright with a constraint, but is otherwise driven by physics and torques. You will then realize that natural-ish values for friction, acceleration, force, and mass, actually feel really sluggish when used in gameplay – because human beings are much weaker and slower than your typical FPS/TPS character. Games are generally tuned to be fun, more than tuned to be actually-realistic.

Anyway, custom movement component, using a capsule physics body. Drive it woth forces and torques. Configure sufficient friction and angular dampening to make it behave reasonably and not explode. Then re-solve networking, because there’s a ton of that in the non-physical standard character movement component that you don’t get when you use a physical body, too.