Calculating Sphere vs. Plane Friction

Hi everyone.

I’m making a 2D side on game where you play as a ball, sort of like morph ball from Metroid.

I’ve come across a really annoying aspect of PhysX friction that I want to avoid.

I have it so that your movement is controlled by both a force in the direction you are trying to move and torque that moves you in that direction as well so that you have greater control over your movements on the ground but still some control in the air.

So when you are moving left, the ball is spinning counter clockwise so that the bottom of the ball is moving right (pushing you left when you are touching the ground) and the top of the ball is moving left (pushing you right when you are touching the roof).

The annoying part is the movement of the top of the ball.

If you are trying to get into a hole in a wall to your left (by moving left and jumping) and you hit the roof during the jump, the friction between you and the roof causes your spin to propel you to the right (away from he wall) instead of the direction you are moving.

After considering all the possibilities I could think of, I think the best solution is for me to use a physic material with no friction and calculate the friction myself in a script where I can simply ignore collisions that are above me.

After looking around for ages, I still haven’t been able to find anywhere the can explain how to calculate the forces involved in friction in a way that I can understand. I have no idea to calculate things like the acceleration and angular acceleration gained by the ball or the appropriate forces that the ball applies to whatever it is colliding with if that thing has a rigidbody.

Can anyone explain how to do these calculations, point me to somewhere that does or think of any other ways that I could get around this problem?

Thanks in advance.

I wouldn’t “roll” the ball at all :wink: Just use a sphere collider (or maybe a character controller) and just move it manually. You can rotate the visible sphere, which should be child in this case, according to the movement speed.

At least in Super Metroid (SNES - which i completed again recently :smiley: ) you just move. there is no ball physic at all. Can’t say anything about the newer games. It’s up to you how you want the movement to be.

I don’t think your friction solution can be implemented that easy. In phyics calculation friction-based forces are one of the most complicated things, since they results in a linear force and a torque.