ending location from angle and speed
I have a facing vector instead of a facing angle. The plus side is you don't need to cos and sin constantly, only when they turn. Then when you want to move somebody you just do
movement=[facing scale:speed];
[position add:movement];
I just made up arbitrary function names but you can probably get the point.
When you want to turn all you need to do is rotate the facing vector by X radians negative for a left turn, positive for a right turn. You can rotate a vector using CGAffineTransform functions.
movement=[facing scale:speed];
[position add:movement];
I just made up arbitrary function names but you can probably get the point.
When you want to turn all you need to do is rotate the facing vector by X radians negative for a left turn, positive for a right turn. You can rotate a vector using CGAffineTransform functions.
| Messages In This Thread |
|
ending location from angle and speed - Kazooless - Mar 18, 2009, 03:56 AM
ending location from angle and speed - ThemsAllTook - Mar 18, 2009, 06:07 AM
ending location from angle and speed - Ingemar - Mar 26, 2009, 02:18 AM
ending location from angle and speed - kendric - Mar 30, 2009 10:52 AM
ending location from angle and speed - masdest - Mar 30, 2009, 07:27 PM
ending location from angle and speed - Gillissie - Apr 3, 2009, 02:40 PM
|
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Formula for converting angle to vector? | komirad | 2 | 8,076 |
Jul 29, 2011 07:29 AM Last Post: ThemsAllTook |
|
| Question Regarding the Reflect Angle of a Transition | iBaby | 3 | 3,037 |
Apr 27, 2010 03:15 PM Last Post: JustinFic |
|
| polling mouse location? | alloca | 1 | 2,211 |
Jan 22, 2009 04:14 PM Last Post: ThemsAllTook |
|
| Angle between two points? | Graphic Ace | 6 | 4,677 |
Nov 8, 2008 12:11 PM Last Post: macnib |
|
| calculating X and Y coordinates w/ an angle and distance | ferum | 13 | 12,675 |
Jun 25, 2008 10:53 PM Last Post: rosenth |
|

