Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a parameter that controls the max slope the character can walk up #42

Closed
ethereumdegen opened this issue Feb 20, 2024 · 8 comments
Closed

Comments

@ethereumdegen
Copy link

I dont see any paramter for this and my character can walk up EXTREMLY steep inclines -- not good

@idanarye
Copy link
Owner

I'm wondering how this should connect to #10 and #11.

@janhohenheim
Copy link

Imo, if we had to pick between this and #10 as a feature, I think we should pick the max slope.
While a slippery ground is a bit of a gimmick, next to every 3D game has varying slopes, so forcing them all to use perfectly "straight" walls everywhere the player shouldn't be able to go through is a bit of a bummer

@idanarye
Copy link
Owner

The reason I want to connect this to #10 is that setting a max slope is slipping. If the player jumps on a steep slope, we want to make them slip down. If I separate between the slope detection and the slipping down, the same two features can be used:

Steep Slope Slippery Surface
Surface Detection Check normal Check surface components
*Slipping * Set to full slipperiness (can't climb up) Set partial slipperiness (can move slower, with less acceleration)

@ethereumdegen
Copy link
Author

ethereumdegen commented Feb 22, 2024 via email

@idanarye
Copy link
Owner

Okay, Okay...

Here is the plan: I'll add a new max_slope parameter to TnuaBuiltinWalk, which will default to half PI (right angle). If the angle between the proximity sensor's normal and the up direction is higher than that, the basis will go into "lost grip" mode, which would mean:

  1. The character will be considered airborne:
    • So that it can't just keep jumping. Unless it has air actions, of course - but then it'll be wasting them.
    • We also want the animating systems to play the in-air animations when this happens. Of course, this state would be queryable so one could have a special animation for that, if they want to.
  2. Instead of applying the spring force in the up direction, it'll be applied in the direction of the normal. Since gravity still apply, this will mean the character will be pushed down-slope.
  3. The basis will cap the part of the forces it would apply in the upslope direction:
    • Without that the player could use air mobility to force the character up the slope.
    • Actually, even if the player wouldn't try to force the character up the slope, the basis would still try to apply forces to "brake" the slide - and we want to prevent that.

One problem I can think of with this plan is that if the game allows unlimited air dashes, these air dashes could be used to force the character up the slope. Not sure how urgent it is to address it though.

@janhohenheim
Copy link

Aah @idanarye, I see now. Didn't think of impassible slopes as slipping before, but you're totally right!

@idanarye
Copy link
Owner

Took me quite a while (mainly because this is PITA code and I had other stuff to work on), but it seems to be working quite nicely:

Peek.2024-05-18.02-19.mp4

As you can see in the video, it doesn't work very well for low slopes. But I'm not sure this usecase is important enough to make it worth fixing. At least not right now.

@janhohenheim
Copy link

Thanks for implementing it ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants