Closed gkjohnson closed 3 years ago
you have this: https://github.com/gkjohnson/three-mesh-bvh/blob/master/example/characterMovement.js#L420-L435 then maybe you should only do player.position.copy( newPosition );
inside of if ( ! playerIsOnGround ) {
?
then maybe you should only do
player.position.copy( newPosition );
inside ofif ( ! playerIsOnGround ) {
?
Thanks for taking a look @makc! Unfortunately if you only apply the new adjusted position from the collisions if the player is seen as "on the ground" then the player will start to sink through the floor because the collision adjustment from the ground isn't applied.
@vin-ni I took a bit of a look at it and came up with a relatively simple fix for the sliding issue in #252. I've updated the example build on master so take a look and see if that fixed it for you.
Thanks, I'll take a look.
Gonna close this for now -- feel free to ping or open a new issue if there's still an issue @vin-ni!
Works for now! Thank you!
Related to #247
The capsule collider being adjusted by all triangles on the stairs results in the character being pushed to the side, then sunk by gravity, then pushed to the side, etc. It results in the character slowly sliding down the stairs. An improvement would be to not slide down corners at all or sliding more quickly so it's not as visually intrusive. The sliding behavior would likely also happen down ramps.