CharacterVirtual experiences jittery behavior when jumping in obtuse corners #1044
-
I don't know if this is just an inherent drawback of how CharacterVirtual is designed, or if it can be alleviated by tweaking the CharacterVirtual settings (I've tried tweaking them to no avail), or if this is a bug that can be tracked down. I've been experiencing an issue in my own implementation using the virtual character controller, and I noticed the same behavior is evident in the sample. When jumping against an inside corner (where two walls meet), continually pressing the forward button while jumping, some corners (those that meet at an obtuse angle) cause the character controller to jitter around. Right angles or acute angles seem to behave just fine. It seems like a minor issue, but it's causing some problems with my gameplay. I'll include a video of some corners that have the issue and others that don't: JoltSampleCharacterVirtualJitterExample2.mp4 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm aware of this behavior. It is a result of the sliding code: The picture above shows the situation from above, in 1 frame it is possible that the character follows the indicated path to slide along both surfaces. The next frame, the user would still press the forward key and it would slide back again over the same 2 surfaces, causing an oscillation. Currently the only condition that stops sliding is if the velocity reverses when it hits a surface: but that's not happening here since it changes velocity 2x. I remember playing around with this a lot and getting to this compromise, but I don't remember anymore what the downsides of other approaches were. |
Beta Was this translation helpful? Give feedback.
I'm aware of this behavior. It is a result of the sliding code:
The picture above shows the situation from above, in 1 frame it is possible that the character follows the indicated path to slide along both surfaces. The next frame, the user would still press the forward key and it would slide back again over the same 2 surfaces, causing an oscillation.
Currently the only condition that stops sliding is if the velocity reverses when it hits a surface:
JoltPhysics/Jolt/Physics/Character/CharacterVirtual.cpp
Line 749 in 5c9d3b0
but that's not happening here since it changes velocity 2x. I remember playing around with this a lot …