Can someone assist me in trying figure out sonic’s momentum in a 3D space, specifically the ability to stick to a sloped surface. I’ve been searching for answers for weeks and it almost feels taboo for people to even mention it. I understand it’s a complicated system but theres nothing to even help get started on wrapping my head around it.
I have followed pretty much all the youtube tutorials and I tried tearing apart a sonic framework kit but due to the interlocking systems I can’t isolate the mechanic without it just breaking entirely.
I’m doing this with blueprint since I can’t code in C# and I get that makes this 10x harder but literally anything at this point would be super appreciated.
Or, just add trigger boxes/volumes over surfaces you wish to stick to and apply an impulse (or force) to your player, downward and perpendicular the floor on overlap. You might need to disable physics and/or constrain movement to a certain axis or a spline to prevent unwanted sliding. This might be trickier with 3D.
Lastly, you could just use foot IK as usual. Make a virtual or real bone that only affects the root but is always pulled to the ground via the normal foot IK control rig method. Essentially, no matter what the momentum/inertia, the root will follow ‘Z’ location of the ‘VB_ik_root’ (or whatever you name it) when not jumping or wheresoever you disable it. This will require understanding what makes foot IK function and adapting it to your needs.
Distilling the above ideas down, you could just add a ‘Scene Component’ located at the base of your capsule, which on “activation” does a line trace downwards and runs a ‘Set World Location’, targeting your ‘Capsule Component’ on tick or timer. You’ll have to add the capsule half-height to the hit location to ensure the capsule isn’t submerged into the ground. This may be crude but likely quicker to setup than the control rig.
I’ve gotten to the point where he sticks to the wall using the set gravity rotation with a simple blueprint, however the movement is still broken. Just like in the video you sent [Unreal Engine 5 Tutorial - Custom Gravity UE5.4 Preview] looking directly at him will on the verticle side of the wall will cause him to grind to a hault unless you follow him manually with the camera.
I do not want the player to manually have to perfectly orient the camera just to move up the wall. I do not know how but the Sonic Frameworks seem to dodge this issue, allowing sonic to smoothy climb regardless of the camera’s pitch axis reletive to him.
As mentioned I’ve tried looking into the frameworks but their blueprints look like spaghetti with zero comments on how and what things are doing on the smaller scale. I’ve tried slowly deleting parts of their blueprints but due to other features relying on the spaghetti code I’m met with constent errors that make it impossible to test.
(The line trace just shoots down from the mesh (The mesh specifically since if connected to the capsual the trace doesn’t actually rotate with the character.) Which is connected to event tick)
I have made a little progress, I’ve figured it out for 2D. It is incredibly crude and this was a proof of concept but I have sonic moving around the loop using A & D.
I am going to try refining this a bit more but the way it works is it checks what direction the player wants to go and then moves towards the forward vector or the inverted forward vector (so it becomes the.. ‘backwards vector’ idk).
So what I need to do:
A - make it work in all direction properly (Also make him rotate towards where he is going, currently holding backwards makes sonic moonwalk and I suspect he’ll do the same for left and right, which I do not want)
B - get the camera to influence the forward vector subltly by getting it to change the relative yaw angle (relative so when it goes up a wall it’s relative to the player not the world, (And also do some fine tuning to make it feel right))
This has been interesting so far. Also I am using a character blueprint at the moment since it’s only the controls there is not point I think reprogramming every little thing (touch wood), but also I couldnt get the pawn to work correctly with collision or gravity so I gave up on that route quite quickly.
So it’s still concept and a bunch of branches as well as not solving other issues I mentioned, but this is what I have:
(You can use the default UE5 Thirdperson Character and just modify what you need to.)
So as mentioned on my previous message, This just detects which direction is being activated. This leads to sonic having tank controls but it works for now (+ it feels good when at speed, especiall if you make a camera follow behind sonic.) This then moves sonic in the direction based on the actors forward movement. we use the forward vector due to the fact that it (unlike world axis) rotates with us.
This code shoots a trace down and slightly past sonics feet which detect the floor and more specifically the up angle, then multipling the result by -1 to invert it and applying it to the players gravity will make the player stick to the surface. (ignore the ‘trace ground → get world location’ it was remnants of an old test, just shoot a trace from the origin to slightly past the characters collision and into the floor you should be fine)
As shown in the video their are still a few problems with this:
First off it is an instant transition when switching between forward and backwards which is incredibly jarring, also for some reason when moving backwards it will not be directly backwards but off by an inch (it’s small but annoying, for me at least but I plan to have sonic switch movement controls based on his speed.)
Forward is still the character forward and not the players camera forward that still needs to be figured out.
Sonic weirdly slides across the floor like he’s on ice when you let go of both forward and back. Adding ground or breaking friction in the charcter movement component doesn’t seem to change anything.
Any solutions to these problems would be amazing. I will be testing solutions in the meantime.
So I’ve been trying to do this but I cannot get it to work. Basing the movement on the camera at all breaks the movement since the camera doesnt rotate with the character, the camera is always up right. This ends up having the same issue as I had previously where instead of moving up the wall, the player character tries running into the wall and at a point completely stops moving.
Also I cannot fix the weird bug of the character moving forward fine, but when going backwards regardless of where you are facing it immediately full sprints backwards south of the map.
I assume you want pressing forward to rotate your character towards where the camera is pointing and move in that direction. What you need to determine is when to use that versus when to use the orientation of stuck to a wall. When you are stuck to a wall, use the mesh rotation as the intended direction of forward. Get Mesh → Get Forward. Because you are using the Character movement component in a way it wasn’t originally designed, you will need to get creative with how you use it to accomplish this.
You will need to determine when the player is attempting to stick to something and swap to the mesh oriented movement. I haven’t played 3d sonic games but I assume you could play them and see how their controls work for movement.