ending location from angle and speed

Member
Posts: 306
Joined: 2009.03
Post: #4
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.
Quote this message in a reply
Post Reply 


Messages In This Thread
ending location from angle and speed - kendric - Mar 30, 2009 10:52 AM
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