# Henri Korpela

Member

5

104 Neutral

• Rank
Newbie
1. ## Utilizing vectors to move entities in 3D space

Thanks, [b]Kyall[/b], for such a useful post! Now I see what are the benefits of using plain coordinates instead of angles to represent direction of where to go to. There's no need to recalculate direction when you can just sum it up to already existing coordinates in order to move requested entity. Simple yet satisfying. Anyway, could somebody still prove why this is true to deepen my understanding (and possibly the other's following this topic): [source lang="c++"]result.x = cos( direction.x ) * magnitude - sin( direction.y ) * magnitude result.y = sin( direction.x ) * magnitude + cos( direction.y ) * magnitude[/source]
2. ## Utilizing vectors to move entities in 3D space

Hi, folks and welcome to the topic! First of all, I'd like to point out that I'm no math genius, but I really got hooked on vectors seeing their benefits in programming entity movement in virtual 2D and 3D environments. There are several vector classes written in C/C++ to be found on the Internet. However, as I'm willing to learn more about vectors all the time, I dediced to create my own class template in C++ called [b]Vector3[/b]. As far as I know, vector consists of a direction and a magnitude. Direction can be represents with the help of other vectors or by an angle. Magnitude on the hand, is simply the line segment from one point to another. Sounds reasonably simple. Now, I'm also willing to create a class called [b]Entity[/b]. In this class I'd like to have a [b]Vector3[/b]-class instance as a member. Via member function called "move" I'd like to use the vector to move some entity, like this: [CODE] Entity bob("Bob"); bob.move(30, 0, 1); // '30' and '0' are both angles, '1' represents velocity, which is in meters per second. [/CODE] Now, if I know both the direction given in angles and the magnitude, not to mention the vector start point in 3D space, how is it possible to calculate the vector end point or do I need to calculate the vector end point in order to move the entity? For me, it makes sense that the movement of an entity happens from one point to another, but how is this movement usually implemented by vectors?
3. ## OpenAL + stb_vorbis - playing .ogg files?

I'm just wondering why my static member function [b]_load_ogg[/b] does not work correctly... Could somebody explain me why?