Jump to content
  • Advertisement
Sign in to follow this  
MercenaryFH

Vector Positions?

This topic is 2883 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So Im completely new to OpenGL learning the tutorials. One thing for the future i'd like to learn (to make some crappy game or something) is like vector positions.

Like......I dont know how to configure them, Like perhaps I had a top down game (like the old zelda games) or w/e.

How do I know how far a position is......and stuff like that, or even as simple as an object transversing to the left or something, how can I "approximate" how far that position is.

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Tbh, I don't understand what you mean. Maybe learn some vector-math first? Or do you mean "how to calculate distance between two points"?

Share this post


Link to post
Share on other sites
Strictly a vector does not have a position.

However you can compute a vector from a start point to an end point in a coordinate system.

Start point (xs,ys,zs)
End point (xe,ye,ze)

The vector is then: (xe-xs,ye-ys,ze-zs)

However if you only see the vector above, you know nothing at all of it's starting point.
It could be anywhere!!...that is something you just got to keep track of yourself.
Easiest is to set it to origo thus (0,0,0).

The length is always sqrt((xe-xs)^2 + (ye-ys)^2 +(ze-zs)^2)

Share this post


Link to post
Share on other sites
In a top-down 2d game, your orthogonal projection matrix determines the 'vector position' of the left/right sides of the screen, and the number of units in-between.

Share this post


Link to post
Share on other sites
Here is a tutorial on vectors and their applications in 3d graphics:
http://aapproj.phatcode.net/qbcodetut/3Dtuts_Relsoft/Chapter_3.html

The source is in qasic, but don't worry, you will be able to understand it ;)
I hope this helps you, if not, please clarify your problems.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!