This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

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));

cueball.set_velocity_x(sin

cueball.set_velocity_z(cos

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trialcueball.set_velocity_x(sin

cueball.set_velocity_z(cos

?

what did you use for cue.angle and DEG2RAD?

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 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.

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.

Game Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.