Skiing - Launching off a slope? I'm sticking to the gound!

Hey guys I’m having an issue.

I’ve scripted out a skiing system, which “works” in the sense that the angle of a slope impacts my velocity and direction(Tracing the Impact Normal of the ground below and multiplying my current velocity) BUT because the engine still thinks I am walking, when I hit an upwards slope at any angle/speed I follow the terrain instead of launching off the ground. It’s essentially like I am locked down on rails no matter how fast or how large the jump is. This also affects my jetpack because while skiing or even simply walking upwards on a hill it causes me to get locked down temporarily, even if it is the slightest incline. Using the jetpack while “not moving” works normally

I played around with the advance vehicle sample and the car launches off ramps in the fashion that I need but vehicles use entirely different physics. I’ve veeeery new to Unreal, I just jumped in this week so I have pretty much exhausted my current knowledge working on this issue

Near the beginning you will see me crest a hill and move along the top trying to jet off it. Around 0:50 when I’m moving up the hill I am actually jetpacking but I’m locked to the terrain…Throughout the video you will see points where I should have launched off the ground but didn’t but at the end of the video a very random occurrence where my character did finally launch off a hill, I believe it is a glitch in the terrain. The problem has to do with the fact that I’m “walking”

I’ve attached the blueprint for Skiing and Jetpack

Here is a video better showing the line traces and how I stick to the ground, I’ll also point out that I can’t jump while moving up a hill either. There is a Print String of the current angle of the slope I’m skiing on as well store an an INT, which I feel may be useful at some point

I’ve solved both the slope issue and the jetpack issue. For any potential people that are curious about how to make a character launch or jump off a slope you need to lower your Max Step Height. You need to be careful about lowering it too much though because weird things start happening.

I set up a dynamic step height based on my current forward velocity (45/CurrentVelocity) and used a Clamp to make sure the value never went below 5. This ensured that my step height was always at an acceptable level while walking but was low enough at high speeds to get me to fly off jumps.

The jetpack sticking to the ground issue was actually quite simple, I wasn’t switching movement modes. I set up the jetpack to switch to Flying when Pressed, Falling when released and the problem went away.

P.S. My blueprints look like spaghetti now

1 Like

I just ran into a similar issue and came up with a slightly different solution. What I found is that UE4 considers the players z velocity to be zero as long as they are in a walking state, even if they are running/sliding up a ramp. Obviously this is not correct, but it’s probably done out of convenience for their default movement preferences.

So when you come to the end of your ramp or the top of a slope no z velocity momentum is considered on the character because it thinks it is zero, thus keeping you ‘stuck’ against the ground.
So what I am doing is calculating my actual Zvelocity and adding it as a vertical impulse when the slope or ramp angle decreases from the last tick. This should allow you to ‘get air’ off of inclines you slide on at high speed, which is the expected behavior I’m going for.

The other issue I ran into is you can be running (or sliding) up a ramp and press jump and effectively not be able to separate off the surface because it does not add the jump impulse to true Z velocity when ‘walking’ up a ramp. IMO this is a bug. Meaning you can be running or sliding 1500u/s up the ramp…and effectively have a 500u/s Z velocity. You press jump giving you a 420u/s Z impulse and go absolutely nowhere because its consumed by going up the ramp. So I add my calculated base Z velocity to my jump impulse when running up a ramp and it now works as desired.

1 Like

Hey Pheesh,

Are you using Get Physics Linear Velocity to determine your Z velocity? And I’m going to guess you are using Current Floor Impact Normal to determine angle difference. But how are you determining the difference between a tick?

This video here shows exactly what you were describing about eating Z velocity.

https://www.youtube.com/watch?v=edB8BNFdyDs

Just changing my Get Velocity in my skiing mechanic to Get Linear Velocity has allowed me to jetpack off hills while skiing, which is a huge improvement. And now I can land on down slopes without losing velocity! Now I need to implement your getting air and work this into my jetpack/jumping. Thanks!

On the tick comparison I have a ramp dot product variable and a “ramp comparison” dot product variable. The ramp dot product variable is set every tick and is calculated for the current tick prior to my comparison check. After its calculated I have the logic comparing ramp dot product vs ramp comparison. Finally, I am only setting my “ramp comparison” variable = ramp dot product AFTER I have performed my logic comparison. So effectively at the time of my check “ramp comparison” will contain the previous tick’s ramp dot product since it hasn’t been set for the current tick yet. I’m not a programmer but that’s the way I can think of. :slight_smile:

For Z velocity I’ve just been using a speedometer variable I already had * (dot product of the [impact normal] vs normalized XYvelocity vector]). I didn’t check into whether it could be obtained from Get Physics linear velocity so maybe that’s more direct. Edit: - I have switched to using the Z value from get physics linear velocity…much simpler :P.

I’m only just implementing this so there may be some simplifications possible.

Alright thanks again Pheesh I’ll play with this once I get home. I hate vector math, I’m assuming you are doing the Dot Product of Impact Normal and 1,1,1 for your ramp variables. Then if velocity is greater than (whatever) and Ramp comparison is less than Current Ramp, add Z velocity as impulse

Sorry for the questions, I’ve been at this one for a few weeks. I even went as far as studying the Project Freefall source code to see how he did Skiing.

kinda sorta. my ramp dot product is between the Impact normal and the current direction I am travelling in XY plane (my normalized XY velocity vector). I have a tough time w/ the dot products/vectors too… The clearest thing I can say is the result becomes positive or negative depending on if you are travelling up the ramp or down. The reason I used current velocity direction rather than say “actor forward vector” is because my implementation needs to work even if I am travelling backwards at the time.

I found in another thread saying you can use Acos(Dot(ForwardVector,ImpactNormal) which outputs the angle in degrees. So many numbers, I will post my results later!

Could you take some more screenshots?

Hey dedrick,

I’m currently trying to make a physics setup very much like yours with jetpacks and skiing (tribes style) and it looks like you’ve gotten much further than me. I was trying to piece together what you had done from the screenshot you attached, but it looks like some of it got cut off. Would you mind posting your updated version in its entirety? Thanks!

Jonathan

I don’t have that version anymore and my current version doesn’t use Ascend style skiing, I never did solve the issue, I ended up going Tribes 1/2 style skiing. I got close, I even went as far as to create my own Movement Component in C++ to change the Z velocity physics. The missing part isn’t really much more than what shows in the shot above, the math after the hit result was Set Velocity = Get Velocity + (ImpactNormal*30). After that it was some Max Step height math that didn’t work properly. I tried many ways to get myself to launch off the ground but none of them worked well or ended up drastically modifying my velocity

I do have this, which is from an older version which is pretty much the same thing but much cleaner, it uses Event Tick and Character Movement->Current Floor for the hit result. The problem arises with how walking and falling works by default. Walking doesn’t store Z velocity and when you transition from walking to falling it zeros out your Z velocity as well (this is changed in 4.8). I would completely ignore the jetpack part in the first screen, it’s very wrong

Great, thanks for this! I’m trying to piece it together now, but I can’t seem to find the block with all the “current floor” outputs you have there. I’m still new to UE, so still trying to figure out where everything is…

Pull out your character movement component onto the graph and from it pull out Get Current Floor. Right Click the return value->Split Struct Pin, then right click the Current Floor Hit Result and do the same. This works for a lot of things like Rotations and Vectors too, it gives you much greater control over what values you can input/output

Ahh… now I see… I had since found all the separate nodes that I had to chain together to get the same setup, but doing it this way is much cleaner. One more question and then I’ll stop bothering you. At the end you do some math for 100-CurrentSpeed and I see your CurrentSpeed variable over on the left, but it isn’t set here. What do I need to do to get that?

Event Tick updates it, I use a sequence node to split event tick into however many things I have running off it

Seeing as we are on the topic of Tribes, I did a tutorial on Inheritance as well if you want to implement it too

I see there is a lot of tribes fans, i’m into unreal too and i thought that, maybe, we can try to build a same game together and not everybody on our own.

wow dude. That’s some freaking good mentality there. kinda sad i’m late for the train, and this post is one year old, cause i would have definitely jumped in the let’smakeagame train. xD

Old thread, but hi I’m from the future… Any chance someone has a working project or tutorial they could share for skiing? I’ve been trying to get that working for a while to no avail. I’ve tried some of the examples here but I must be missing something.

Same! I’d love to potentially do a snowboarding mini game at some point