Hi,
I have a very simple player pawn with ability to jump. It is simulating physics, but because I don’t want it to bounce, I created a physics material in which I set restitution and friction to 0, and assigned it to the pawn. ASlso, I have a floor represented by static mesh, to which I also assigned the physics material. So, both my player and floor have bounciness set to 0. And yet, every time player’s pawn jumps and lands, it also bouncess off the floor, and I don’t know what am I supposed to do. I tried changing some values in Project Settings->Engine->Physics, but it didn’t help. Is there anything I can do to fix this?
Is your pawn using its own Capsule component for collision?
Or is it using the Character base class?
If it’s using Character, then that’s all its own simulator, and only loosely conforms to the rest of the physics engine.
If it’s your own Capsule component, then what you’re seeing is likely residual velocity from collision separation.
One reason why this can happen, would be if the capsule slightly penetrates the ground, and then gets pushed out; that push may impart some separating velocity even without explicit restitution being modeled.
You may be able to reduce that effect by turning on swept movement/checking.
If that’s not enough, then the next option is to detect when you go from “not in ground contact” to “in ground contact,” and for this step and the next step zero out any part of the capsule velocity that moves in the contact normal direction. E g, get velocity, dot with contact normal, negate this, and set the velocity to that. (Or apply an impulse to compensate for exactly that, if you don’t use velocity setting in your simulation.)
This, and many other things, is where the Character pawn base class (and its CharacterMovementComponent) comes in; it does this, and many more things, to try to give the “expected” FPS capsule-character movement characteristics. If you decide to roll your own, you’re giving up on all this, and have to replicate whatever the bits are that you need.
To anyone interested: I managed to fix the problem. How? How tf am I supposed to know?