Character Sledding / Add force based on floor angle

I’m my game we have a sledding mechanic. The problem I’m facing is applying a forced to the character based on the angle of the floor. Essentially the character is snowboarding down a hill and needs to be able to add forces left and right to turn but forward momentum should be mostly handled via the angle of the ground. Essentially i want to enable physics on the character. When I enable physics on the capsule comp. it flips out and goes all crazy. I currently am getting the angle of the floor and trying to add a force to the character movement component in the direction “down” via the angle of the floor. This isn’t really working tho if the floor isn’t in a perfect rotation in x,y,z. Any ideas? I think the easiest way would be to enable physic on the character but prevent it from going crazy? Thanks

Im confused on why you want to add force based on the angle of the floor? Wouldn’t you want to add force in the forward direction of the sled. The sled will angle at the same angle of the floor its on, so you want force in its current forward angle. (Which should be the X). So you would want to use “get forward vector” on the sled (or character).

If you needed to make the sled “stick” to the angle of the floor then you could do a downward line trace to get the hit normal then multiply that by a negative number that feeds into an apply impulse node on the sled.

I would want to add a force in the forward direction of the sled, however I need to find a way to keep the forward direction of the sled rotated down the slope. Not sure how to maintain the correct forward rotation. I want the sled forward direction to be based on the slope. The forward direction would be the “down” direction of the slope. I’m unsure how i would figure this out because it can be completely different depending on the ground, it almost certainly wouldn’t just be in a clean x/y direction. Imagine a hill spiraling down, the forward angle would constantly be changing. I’m not sure how i can get this forward direction, essential the vector that a ball would roll down the slope. If that makes any sense.

Hey, I’m working on a project that needs a similar treatment. We have a skiier going downhill (controlled by an old arcade machine for turning) where the forward movement is gravitational. Physics simulation results in some wonky movement, especially while turning to the side. I’ve had the character reverse direction and go uphill.

Any updates on your project @Electus1?

It depends on how your character is set up but the first method that comes to mind is …

-Add a sphere component to the character parented to the skeletal mesh.
(actually a static mesh using your own is better, but anything with Simplified Sphere physics)

-Set a timer that puts the sphere at relative 0, 0, 0 every say… .5 seconds. Collecting the direction the ball has moved and distance.

-Now you can apply the distance traveled by the ball and the direction it’s found at to add as movement input.

The result is the ball drags the player in the direction it is trying to roll, the steeper the incline the further it goes, so the more input is applied.