Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Pool/Snooker - Back and Side Spin

Author
Message
Qweeg
20
Years of Service
User Offline
Joined: 23rd Sep 2004
Location: Kent
Posted: 18th Aug 2005 17:40
Does anyone have any ideas on how to implement backspin and sidespin in a pool game please? I have looked through Hamish's sample pool code, which is a great help on the general collision and motion, but doesn't inlude spin. Also there was a community pool game project, with a thread set up by Kimosabi, but that seems to have fallen by the wayside and again the inital code didn't seem to cater for spin.

Any help would be much appreciated.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 18th Aug 2005 18:00
Well spin could be regarded as a vector, like X and Z speed, depending on where the ball is struck and how.

For instance, say you hit the left hand side of the ball to set it spinning left - well you'd gently rotate the balls trajectory to pull it into an arc, while the speed reduces so does the spin, but independantly. So it might be completely stationary but spinning still - this might happen if it hits a ball at speed while spinning. So you need to treat the spin seperately because if your hitting the very bottom to rebound the ball back, it needs to be spinning back, then when it hit's another ball reducing it's movement speed, the bounce back speed takes over causing it to roll back. Maybe look into what is happening when the balls collide, then affect the extra spin vectors to suit. Remember that colliding balls will affect each others spin, hitting a stationary ball with a spinning ball would cause the stationary ball to spin too.


Van-B

Put those fiery biscuits away!
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 18th Aug 2005 18:04
Hmmm.... tricky. Have a look at the challenges thread - the pool physics challenge is where the idea for the community project you mentioned came from. I don't think spin was incorporated by anyone for the reason that there where more fundamental issues to resolve first, but it might be a good starting point.

Kim Possible
19
Years of Service
User Offline
Joined: 13th Aug 2005
Location: Where ever there\'s trouble.
Posted: 18th Aug 2005 20:00
Pool ball/table physics is fun. Ball to Bumper coefficient of restitution, ball to ball coeff of rest., damping forces, friction (static and kinetic), ...

have a look at Hook's spring constant. Also - consider making your balls particles. Impulses and dot product will probably be simpler.

I have working ball-to-ball induced spin and cue-to-ball induced spin in C++ if it helps at all I could send it along. I never got around to bumper collision induced spin however...

DBP + VC Ent.Studio | Maya, MAX, Soft3D, MilkShape, Character FX | 3.0Ghz P4, IC7G, GF 6800GT (primary) / 3200XP, A7N8x, GF 6600GT (secondary) / 6x dual 2.8Ghz Xeon SuperMicro (renderfarm)
Kim Possible
19
Years of Service
User Offline
Joined: 13th Aug 2005
Location: Where ever there\'s trouble.
Posted: 18th Aug 2005 20:03
Actually, thinking about it, there was a decent bit of pool simulation in an old issue of Game Developer magazine... Ummm. Probably end of 1999. Somewhere around Sept-Nov.

www.gdmag.com/code

Yeah - here it is: sep99.zip - go to that page and cntrl-f search on sep99.zip

DBP + VC Ent.Studio | Maya, MAX, Soft3D, MilkShape, Character FX | 3.0Ghz P4, IC7G, GF 6800GT (primary) / 3200XP, A7N8x, GF 6600GT (secondary) / 6x dual 2.8Ghz Xeon SuperMicro (renderfarm)
Qweeg
20
Years of Service
User Offline
Joined: 23rd Sep 2004
Location: Kent
Posted: 19th Aug 2005 10:59
Thanks for your tips guys. Kim, I have the Code from games developer now thanks and will try and work through it (although my C/C++ is very poor). For information I also found a site with a pool game and source code included (again in C):

http://foobillard.sunsite.dk/

...and I spoke to Florian, who wrote this program and he gave me the following pointers:

Quote: "
ive had this question coming up a couple of times.
so here some brief introduction to ball rotation physics:

L...angular momentum (vector)
M....torque on the ball due to friction forces, etc. (vector)
F....force (vector)
d....distance vector of force point to center of ball (vector)

lets say dL is the change of the angular momentum in the time interval
dt:

dL = M*dt (1)

and

M = F x d (cross product) (2)

And the angular momentum L is actually the vector parallel to rotaion
axis with length I*omega

omega is the rotaional frequency (2pi * revolutions per second)
I is the mass moment of inertia

so all you have to do is calc the torque by eqn.(2)
then calc the change in angular momentum by eqn.(1)
and add it vectorially to the angular momentum L of the ball.

the most tricky part is to switch between rolling and sliding.
"


On first glance I don't really follow this (physics was never my strong point), but am going to spend some time trying to get my head around the physics involved.

Login to post a reply

Server time is: 2025-06-06 11:00:51
Your offset time is: 2025-06-06 11:00:51