Jump angle relative to surface?

Hey men and gentleladies!
I’m rather new to Unity, but I’m learning fast.
I’m trying to make a jump script that makes the rigidbody ‘player’ jump in an angle relative to the surface it’s placed on.
I.E. if you’re standing on a 45degree angled surface, the player doesnt jump straight up, but jumps out in a 45degree angle, 90degrees on the surface.
I’m using C# for all my scripts, but I have no clue on how to make this. There’s no constant ‘up’ direction of my player, since its a rolling sphere, so I can’t use that, unfortunately.
Anyone have an idea of how I can solve this in a good way? :slight_smile:
Thanks in advance

Hi !

So, you need the normal of the ground you’re rolling on. As you’re using a rigidbody, you can use the function OnCollisionStay, which gives you access to the contact points and the normal.

I’m not explaining everything, partly to keep a bit of mistery, but mostly because I think people learn better when they have to search a bit, once on the right path.

Good luck :slight_smile: