How to make slope physics? (Speed based)

Hey! I’m making a platforming game in UE4 and I’ve been trying to implement slope physics (e.g. sonic going around a loop). I’ve been looking for blueprints for a long time but no luck so far.

If youre trying to make a sonic fangame you will probably need to get into some C++ or do something even more painful in blueprint.

But if you just need downhil to be faster and uphill to be slower by an amount depending on slope angle,
you can on a very short timer (like 0.1 sec) or on tick,
first check if Character pawn is walking or falling (has some auto-set bools for that)
if his feet are on the ground, you can get the angle of the surfacehe walks on (might need a line trace and get Hit Normal from the hit result breakout) and Dot product that with the character’s UpVector to see how far from flat it is (range is -1 to 1, where 0 is perpendicular) You can set maximum walk speed each timer fire or tick based on this percentagey value by subtracting ir from 1.0 and then multiplying it by the fastest downhill speed you want the character to be able to do.

Note- you have to add more logic to make it accelerate gradually instead of instantly being able to go that speed based on the slope but theres a start for you.

I saw a youtube tutorial that tells step by step how to do this but im afraid i dont know the name or link for it.

Thanks for the heads up! I figured it wouldn’t be too easy to make a game with such complex physics. I found a video that goes over the slope speeds similar to how you explained it, but I’m really trying to find a way to make my character be able to walk on certain surfaces. I want him to be able to run around the inside of a pipe circle, but I don’t want him to walk on walls without any smooth transition on the ground. Does that make any sense?

Sounds like you’re making a Sonic fangame. You’re not the only one - I think there should be a special group just for people making Sonic fangames in Unreal because you pretty much have to program your own physics it seems like, if you want it to act like sonic.

I searched the other Unreal forum and found somebody had made a REALLY good Sonic fangame with Unreal Engine though. Sorry I again don’t have the link but I shared it with @TheBonkBatter.
I’m not sure what has to be done to get the engine to do that, but it might be a custom version of the engine that you have to Build in Visual Studio (hopefully not).

But yeah Sonic or similar movement is not your average platformer physics, that’s for sure. The original game’s programmer was a genius.

Something to keep in mind if you’re using the USUALLY-handy Character class as your actor base: It does so much for you that you didn’t realize you needed for first-person and third-person networked multiplayer shooter games and animation management etc, and doesn’t use simulated physics, just pretend kinematic physics, and does it all with the assumption of an always-vertically-oriented character, that it might be getting in your way in some ways while helping you in others.
This makes it hard to decide whether modifying it or programming all of that crazy extra stuff yourself would be easier.

Probably the best thing would be to find someone who’s already done it in mimic how they did it. But you won’t find that kind of capability in anything the comes packed with the Engine, just the ability to make it yourself.

Here’s a guide on how they did the 2D physics of the original games or something like that:
http://info.sonicretro.org/Sonic_Physics_Guide

And this appears to be a custom version of the Unreal Engine or at least a project using the normal version of the Unreal Engine to achieve Sonic-like movement:
https://forums.unrealengine.com/community/work-in-progress/28494-sonic-unreal-worlds-open-source-ue4-sonic-engine/page3

I’m making a lot of assumptions and maybe this isn’t what you needed, but if it is, then there you go :slight_smile: