On 03/14/2011 02:13 AM, Kevin Fishburne wrote: > I'm trying to move a point with an angle/direction/vector relative to > its angle. Let's say I have these variables: > > Dim a as Single ' Point's angle in degrees. > Dim x as Single ' Point's x coordinate. > Dim y as Single ' Point's y coordinate. > Dim xvel as Single ' Point's right/left velocity (+/-). > Dim yvel as Single ' Point's backward/forward velocity (+/-). > > What's a good algorithm to figure out the new values of x and y when > adjusted by xvel and yvel relative to a?
After more research I got a little closer, trying this: ' Move player relative to player's orientation. worldx = worldx + ((Interface.stick_leftx / 131072) * Cos(Rad(orientation))) worldy = worldy + ((Interface.stick_lefty / 131072) * Sin(Rad(orientation))) It lets me move horizontally but not vertically unless I rotate the player. What am I doing wrong here? FYI, the Interface.stick_left variables are divided by 131072 so that they are compressed from the range +/- 32768 to +/- 0.25, the maximum movement speed for testing. I feel I'm so very close, yet so very far. -- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sa...@eightvirtues.com phone: (770) 853-6271 ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user