-1

This is another question on PyParticles4.py(4th version).

The Particle Class
Circular 2d objects with radius,mass,velocity,location

I was thinking of making a version of this game on python, using pygame and PyParticles. The only thing I am puzzled about is the friction of the balls to the surface(pitch) below, when it bounces.

So, Any ideas on that??
Also, Is it possible to show rotation of a ball(without making a new class) and change it realistically(application of a force) so the ball 'spins'(cricket term)??

pradyunsg
  • 18,287
  • 11
  • 43
  • 96
  • 1
    What have you tried? Good questions for StackOverflow are related to code issues you're having. If you're just getting started, try something first, then ask about the issues you run into! – Blckknght Jan 08 '13 at 11:41
  • @Blckknght The issue is that I have no ideaI(also can't think of one) how to apply friction to the particle(circular object) also changed the question to be clearer – pradyunsg Jan 08 '13 at 13:23
  • Are you writing your own physics, or using a physics engine? – ninMonkey Jan 08 '13 at 18:01
  • @monkey Actually it is the extension of the Particle class as in http://stackoverflow.com/questions/14137475/python-ball-physics-simulation.. Same Module.. – pradyunsg Jan 09 '13 at 10:50
  • Do you mean the "friction" when the ball bounces, or when it rolls? – Beta Jan 10 '13 at 14:57
  • @beta When the ball bounces, it should spin.. – pradyunsg Jan 11 '13 at 06:34

1 Answers1

1

Assuming the ball is hitting a non-moving object(as in the game)

You can use the rotation speed of the ball, then multiply that with the friction constants of the ball and the surface it contacts, then another constant(i)(for making it usable).
That is:

 x = ball.rpm * ball.friction * pitch.friction * i  
 ball.angle += x  

Then tweak iand the *.friction constants till you get the required result.