# The problem of cue ball rotation in billiards

Discussion in 'Physics' started by shaoli198, Sep 6, 2019.

1. ### shaoli198

Joined:
Jun 23, 2019
Posts:
1
Description: I have a game of billiards and I want to simulate the effect of billiard ball spinning. That is, the club hitting the ball at different points will produce different rotation effect. For example, if you hit the cue ball below the center of the ball, the ball will go forward and spin.

My solution: a UI to adjust the offset, using the position of the cue ball plus the offset to hit the dot. Use AddForceAtPosition on the cue ball.

Code (CSharp):
1. offset = new Vector3(PlayerPrefs.GetFloat("offsetX"), PlayerPrefs.GetFloat("offsetY"), 0);
2.
3. ball.AddForceAtPosition(direction.normalized *5, ball.position + offset,ForceMode.Impulse);
4.

Problem: the offset is the obtained Vector2 set on the UI. Now, if it is moved along the Z axis, it is ok to offset x and y. How do you calculate the offset in the other direction? Known are the moving vector of the ball and the offset of Vector2 and the Angle of the club rotation

File size:
136.8 KB
Views:
97
2. ### EliJNemer

Joined:
Aug 3, 2019
Posts:
38
I was thinking about this I think that it might be a good idea to just have the UI as a ratiotic reference and you set the spin on the balls.. for example you hit the ball dead centre you do
Code (CSharp):