Jump to content

View more

Image of the Day

Full Syncs #screenshotsaturday favourites https://t.co/i1Flnwcg3l #xbox #ps4 https://t.co/m0v2F1SxGs
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

sphere vectors 2D to 3D

2: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 noobnerd   Members   

128
Like
0Likes
Like

Posted 08 January 2013 - 02:21 PM

hi everyone and thanks for helping me with the questions ive asked so far.

 

I have encountered yet another problem in my billiards (pool) game, when trying to do a kind of selector which allows you to select where on the ball you want to hit.

 

I want to have a circle which symbolizes the side of the cue ball facing you. you can then click anywhere on the surface of the circle to select the spot you want to hit. now to calculate the change in agular velocity i need the vector (3D) that goes from the center of the ball to the point which i just selected. That is a radius to the surface of the ball. considering that the ball is "pointing" in the direction that you are going to shoot it means that if you select the precise center of the ball you are going to get the vector  -F/|F| r   that is the vector in the vector in the opposite direction of the shot that has length r which is the radius.

 

can anyone help me with this? if my formluation was confusing i will try to draw it somehow.

 

cheers

 

 



#2 Álvaro   Members   

20820
Like
1Likes
Like

Posted 08 January 2013 - 04:52 PM

I assume you are presenting the ball as a circle by orthogonal projection, you can look at the situation in coordinates where the projection is simply removing one coordinate. So you'll plot (x,y) and ignore z for this view. You can recover z by solving x^2+y^2+z^2=r^2 : z = sqrt(r^2-x^2-y^2), or perhaps minus that, depending on your conventions.



#3 noobnerd   Members   

128
Like
0Likes
Like

Posted 09 January 2013 - 02:38 PM

thank you for they quick answer it worked perfectly. 






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.