Math Help Forum

Math Help Forum Feed Site Feed

Go Back   Math Help Forum > Pre-University Math Help > Geometry
Reply
 
Thread Tools Display Modes
  #1  
Old May 4th, 2009, 09:40 AM
Newbie
 
Join Date: May 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Gaz_j03 is on a distinguished road
Default Working out destination from starting point, angle and power

Bit of a strange problem and I hope i've posted in the correct place.

I am writting a computer game (very basic golf) I have three sliders I can set:

Power(0-100)
Angle (-90 - 90)
Start position of ball(represented in the code by an x and y co-ordinate)

after each is set, then I hit the button "SHOOT"

I want to know how I can work out the vector from the above (the change in x, and the change in y)

Although it is for a game its the same principle as paper. Imagine a top down view of a piece of graph paper with each line being numbered along the x axis and same on the y



Any help would be really appreciated greatly
Reply With Quote
Advertisement
 
  #2  
Old May 5th, 2009, 09:02 PM
billa's Avatar
Member
 
Join Date: Oct 2008
Posts: 77
Country:
Thanks: 31
Thanked 6 Times in 6 Posts
billa is on a distinguished road
Default

Hopefully I can help

First of all I am going to assume that you have some kind of maximum velocity constant for your ball.

The vector you want would probably be...
dx = (power/100)*Maximum_Velocity*cos(angle)
dy = (power/100)*Maximum_Velocity*sin(angle)

That would be the velocity vector and you would add it to the position vector

Tell me if this works. I used to program games so I might be able to help if you need anything else.
Reply With Quote
The following users thank billa for this useful post:
Donate to MHF
  #3  
Old May 19th, 2009, 04:26 PM
Newbie
 
Join Date: May 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Gaz_j03 is on a distinguished road
Default

I'm not very familiar with vectors. When i read it I assumed i'd take the dx value and dy value and add them to x and y representing the current position of the ball? But this does't work.

The figures output are nowhere near so i think i misunderstood you, sorry. Could someone clear this up?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -7. The time now is 04:55 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
©2005 - 2009 Math Help Forum


Math Help Forum is a community of maths forums with an emphasis on maths help in all levels of mathematics.
Register to post your math questions or just hang out and try some of our math games or visit the arcade.