Link to home
Start Free TrialLog in
Avatar of Stephen Chamberlain
Stephen ChamberlainFlag for Netherlands

asked on

Snooker Physics Problem

I have the cue ball on my snooker table. The Cue tip rests at the cue ball, and the user swings the cue round wth the mouse. Now, the velocity exerted on the cue ball by the cue is directly through the centre of the cueball, given an angle theta that the cue is around the ball in the XZ plane, how do i represent the velocity vector? This is my current calculation, and through a process of guesstimation, ive tried different COS/SIN combinations and still dont get anything sensible.

cueball.set_velocity_x(sin(cue.angle*DEG2RAD));
cueball.set_velocity_z(cos(cue.angle*DEG2RAD));
Avatar of ozo
ozo
Flag of United States of America image

How do you get cue.angle?
Avatar of Stephen Chamberlain

ASKER

cue.angle is obtained from the mouse. As the user moves left or right, the cue swings around the cue ball. It is also clamped between 0 and 360 degrees.
If you would like a visual idea of what I mean, please visit my site, then under the uni-work section from the menu bar, select the snooker simulation and there is a screenshot.

http://www.steve-chamberlain.co.uk/

Avatar of NeilNeilOrangePeel
NeilNeilOrangePeel

I think u want to use x = cos(theta) - sin(theta), y = sin(theta) + cos(theta)
I have tried that but the result does not seem to be correct. I am also (for the time being) discounting the Y-axis as a simplification to my system (i.e. the balls are confined to the XZ plane and you cannot do a 'jump' trick shot). Thanks for the input though.
ASKER CERTIFIED SOLUTION
Avatar of NeilNeilOrangePeel
NeilNeilOrangePeel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
what did you get when you tried
cueball.set_velocity_x(sin(cue.angle*DEG2RAD));
cueball.set_velocity_z(cos(cue.angle*DEG2RAD));
?
what did you use for cue.angle and DEG2RAD?
This is going to sound like a bunch of silly questions, but based on your description, I can't think of anything else to add. (sounds like it should work)

What level of detail are the cueball velocity and cue angle numbers stored in? (float or double)

Are you sure that you have stored the cue angle in degrees?

Are you sure that the sign is correct for your velocity equations?

Are you sure you have the correct conversion for cue angle in DEG2RAD?

What do you mean by sensible? (completely wrong or a little off)
The velocity and angle are stored as floats.

The angles is stored in degrees, and the conversion to radians is correct.

I am now sure that :

x = cos(theta) - sin(theta)
z = sin(theta) + cos(theta)

is the correct answer and will accept this as the answer, it provides 'correct' results, i.e the ball moves at the same speed in any direction, as opposed to when it was moving very fast in one direction then just slipping in another direction. However I still have some problems, but i can sort those out in due course.

Sorry to dig up a dead topic, but the accepted solution sounds completely wrong.  I think that the problem is that you're not multiplying cos(theta) or sin(theta) by the speed of the cue.

The equation should be Vx = speed*cos(theta); Vy = speed*sin(theta);

If this doesn't work, then it means that you're giving this function incorrect values for speed and theta.