Sign in to follow this  

Vector Positions?

This topic is 2663 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
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
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

This topic is 2663 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this