Question

XYZ Coordinates, 360 Rotation.. How to calculate? AutoIT Visual Basic, Visual Studio

Asked by: jay1996

Hello! Ive got a homework assignment for my game Dev. class, and the assignment is to find XYZ coordinates of the player (which I have now) then map out a path with the XYZ Coordinates, while writing the XYZ coordinates to a Config.ini file every .5 seconds for later use, So I have that part down pack, im able to record player movement through XYZ coords to an config.ini file, But now Im stuck at the last part of the project!

We have to take the recorded path coordinates we recorded and read from the .ini file, which isnt the the problem., my problem is player rotation! Im wondering how do you calculate which way the player would have to turn to goto a certain coordinate, (like a GPS points to a saved coordinate)  So theres a 360 Degree rotation, and say the next coordinate the player needsw to walk to is X:-6381 Y: 471 Z: 378 (These are rounded to the closest integer) So how do I calculate which way or how much the player needs to rotate to move in that direction?!
Thanks so much in advance for the help, Im enjoying my stay here.

Also, Im programming this in AutoIT V3 Beta since its an open "Freestyle" project, But if someone knows how to do it in Visual Basic, C++ or C# ill understand any of those, doesnt need to be strictly an AutoIT answer, Thanks.

p.s, Ive heard it would be easier to use 180 Degree rotation for the calculation of player rotation.... Let me know your opinion. Thanks alot

AutoIT V3 BETA - $PlayerRotatiion = ?
Visual Basic - Dim playerRotation = ?
C++ - player rotation = ?
 
please help! :p

                                  
1:
2:
3:
4:
5:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-01-30 at 07:11:11ID24098538
Tags

Microsoft visual studio 2008

,

autoit

,

beta

,

visual basic

,

C++

,

C#

Topics

Game Programming

,

Visual Basic Programming

,

C++ Programming Language

Participating Experts
2
Points
500
Comments
13

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Rotation
    When we rotate an object about an axiz parallel to co-ordinate axis the original co-ordinates of object changes slightly (where they should not) . How we can solve this problem.
  2. Window Coordinates (OpenGL)-> coordinates with reg…
    This question pertains to OpenGL. I have a rotated texture. The coordinates I have for some other part of the program are in Windows coordinates (full on view, zero rotation). How can I tranform these coordinates to fall within the rotated textures object coordinates? Than...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: jgordosPosted on 2009-01-30 at 07:32:30ID: 23509210

You don't really talk about your math background, so I'll start there...

have you done much with vectors?

-john

 

by: jkrPosted on 2009-01-30 at 07:48:39ID: 23509439

Take a llok at

http://www.fastgraph.com/makegames/3drotation/3dsrce.html ("The Mathematics of the 3D Rotation Matrix: Source Code")
http://www.tutcity.com/tutorial/rotation-matrices.1142.html ("C and C++ - Rotation Matrices tutorial")

Both cover the maths and the programming backgound, and you will have a good time learning from these.

 

by: jay1996Posted on 2009-01-30 at 12:30:04ID: 23512572

well im not doing 3D programming or anything like that yet, Just making a third party program for the teachers game that he provided the whole class, it consist of a lil character toon guy, that can run around, jump, walk, etc, So i need to make a program that records the characters XYZ coordinates in an Config.ini file then make him run that path with the XYZ coords, Ive got him moving but he isnt rotating to the direction of the next coordinate... he is just running straight ahead... Sorry if you misunderstood me , ill read this links tho jkr, but im pretty sure ill be using PI conversions (3.14) / (180) but im not sure how to go about doing this correctly in AutoIT (which has some similar C++ syntax) or an explanation or code snippet in anouther language like C++, VB or C# I can understand...I always can learn alot better from a code sample....Let me know thanks guys

 

by: jkrPosted on 2009-01-30 at 12:32:49ID: 23512599

If you are dealing with 3d coordinates, you *are* doing 3d programming ;o)

And yes, you rave to use radioant coordinates in most programming languages.

 

by: jay1996Posted on 2009-01-30 at 13:38:35ID: 23513279

yes the game is 3D but im just trying to get the formula to use so the program can figure out wat direction to turn by the coordinates of his current position and the coordinates of the next waypoint to run to, just like a GPS points to the direction of a saved coordinate so if theres a 360 degree of possible output, I need the formula to figure out say if the current position of toon is [X is -2000, Y is -210, Z is 78 ] and the nexy waypoint is [X = -1000, Y = -310, Z = 42]  Anyone know what the math formula is to figure that out? im sure theres a math problem that deals with this :p

 

by: jkrPosted on 2009-01-30 at 13:42:46ID: 23513316

It is not a plain formula, it is matrix algebra - check out the rotation matrices above, they will have the formulas for the individual coordinates as well. Also see http://en.wikipedia.org/wiki/Rotation_matrix for more details.

 

by: jgordosPosted on 2009-01-30 at 15:18:25ID: 23514019

There is not a universal answer for this problem.

Your co-ordinate system, and how you represent it will be different from mine.

however, have a look at this web tutorial.  It's pretty simple, and it covers the basics.

Also, consider for a moment, the trigonometric function, arctan.

-john

 

by: jay1996Posted on 2009-01-30 at 18:57:16ID: 23515027

you say look at this tutorial but you didnt post any links..... isnt there a conversion to find the direction that a coordinate is in like north south east west?? you guys are making it seem so much harder then i feel it is! Thanks for the help so far and all, ive read those pages bbut they are dealing with making 3D worlds and camera rotation, I just need a plain formula just like a GPS uses to point in a north south east west  my direction....it just seems like when i look at those tutorials they look like nothing my teacher was talking about, seems to advanced of 3D programming for the starting assignment....if anyone understands what i mean and could give me an answer, code snippet whatever anything! It doesnt have to be exact, just a way to find out whatdirection a set of XYZ coords is in. thanks

 

by: jgordosPosted on 2009-01-31 at 08:47:09ID: 23517402

ooops sorry.  i mean to post a link...

http://chortle.ccsu.edu/VectorLessons/vectorIndex.html

And I'm sorry, but there is no such thing as north, or south or whatever.  Your resistence is futile!

You yourself said you have points in 3 space.. X, Y, and Z values.

Tell me, what's "North"?

In your euclidian space, (XYZ), which direction is negative X? which direction is positive Z?

-john

 

by: jay1996Posted on 2009-01-31 at 12:33:23ID: 23518371

ok well theres a map in the game that shows which direction north south east west is just like our world has XYZ coordinates and N S E W, So if I get the coords from the very north of the map, then the coords from each point of the map (south, east, west) This will atleast tell me about where north is and show, then from there theres got to be an math equation to figure out which direction the next waypoint is cloest to! This makes perfect sense to me, Im just looking for an answer, Im not into vectors or programming a game I programming a small third party app that rotates the character with _MouseMovePlus() function and runs a path, this isnt the hard part of the class...hopfully you can understand what I mean....If you know some things about the situation theres always a way to figure it out, Since I know the game uses N S E W Im going to get those coords, Ill map my findings...hopflly i can do it myself...thanks i guess

 

by: jgordosPosted on 2009-02-02 at 17:31:03ID: 23533355

That's not what I'm saying...

If you're on a standard X, Y grid (like a screen) then the coordinates usually go something like this:

0,0 at the top left                                             1024,0  (top right)
0,768 bottom left                                              1024,768 (bottom right)

So, do you really need to have your Z coordinate in your heading?  

If not, then the math is really simple...

If my next point is to the left of me (x is less than my current x) then face left
if my next point is to the right of me (x is more than my current x) then face right

Like that...

Same with Y values... face up or down based on where you're heading.

Is that the sort of answer you're looking for?

-john

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...