# Vector Positions?

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

## 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 on other sites
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 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 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 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.

1. 1
2. 2
3. 3
4. 4
5. 5

• 14
• 9
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
632911
• Total Posts
3009187
• ### Who's Online (See full list)

There are no registered users currently online

×