Tuesday, November 1, 2022
HomeGame Developmentc++ - Answer for back-and-forth jitter when sliding down terrain slopes?

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


I’ve acquired a C++ app the place the participant is represented by a vertical line section, strolling on triangulated terrain. There’s some terrain sliding that permits you to stroll on the terrain so long as the slope of the triangle underneath your toes is not sharper than 45 levels. Whether it is, you start sliding down with gravity. There isn’t any friction, so the participant falls on the similar 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 both sides of a crease are too sharp to stroll on, such that the terrain is attempting 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 both sides of that crease/slide needs to push the participant again over to the opposite aspect on the following 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 underneath that newly-projected level, and making the push vector be a mean of that projected level’s slope vector and the present slope vector, however one way or the other this feels a bit flawed/hacky?

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

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments