Home Game Development c++ – Solution for back-and-forth jitter when sliding down terrain slopes?

c++ – Solution for back-and-forth jitter when sliding down terrain slopes?

0
c++ – Solution for back-and-forth jitter when sliding down terrain slopes?

[ad_1]

I’ve bought a C++ app the place the participant is represented by a vertical line phase, strolling on triangulated terrain. There’s some terrain sliding that lets you stroll on the terrain so long as the slope of the triangle below your toes is not sharper than 45 levels. If it’s, you start sliding down with gravity. There’s no friction, so the participant falls on the identical vertical velocity as if free-falling. If a state of affairs happens within the terrain the place there is a concave “slide” the place two angles on all sides of a crease are too sharp to stroll on, such that the terrain is making an attempt to push the falling participant to the middle of that crease as he falls, then what happens is a back-and-forth jitter every body, as a result of all sides of that crease/slide needs to push the participant again over to the opposite aspect on the subsequent body.

Is there a basic/elegant answer for this? I thought-about projecting the participant’s place primarily based on the present slope, discovering the slope below that newly-projected level, and making the push vector be a median of that projected level’s slope vector and the present slope vector, however someway this feels a little bit fallacious/hacky?

I’ve tried as an example the state of affairs right here, the place the blue arrows symbolize the normals and thus the path the falling/sliding participant is pushed. Any recommendation can be tremendously appreciated! enter image description here

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here