-- [ Picked text/plain from multipart/alternative ] Vectors hold a position x,y,z or a direction x,y,z. Although they could also use them to store yaw pitch and roll valve created a seperate class for that I believe, QAngle.
What they hold depends on where you get the value from. CBaseEntity::GetAbsOrigin() will give you back a vector with an absolute world position. There is also GetLocalOrigin which will give you a local positional offset from something you are parented to. I've not used this much, but I would assume that might be an offset from a vehicle you are in, maybe an elevator or moving platform or something, though I could be wrong. CBaseEntity::GetAbsVelocity: Velocity is often expressed as a direction vector as well, with the length of the vector representing the speed. As a simple example, an entities position will be updated by some code like position += velocity * deltaTime; In this case the length of the velocity vector is significant. To get just the direction without the 'speed' component you would normalize the vector. Some purely directional attributes of entities operate from a normalized vector. HL2 stores many of its directions in the QAngle class. For example, CBaseEntity::EyeAngles() returns a QAngle, which I normally convert to a directional vector because I find them easier to work with. Vector vFwd, vRight, vUp; QAngle viewAngles = pEntity->EyeAngles(); AngleVectors(viewAngles, &vFwd, &vRight, &vUp); Most useful in this case is the vFwd vector, so you can optionally pass null to the right and up parameters to save a bit of work. Vectors are overall pretty nice and easy to work with, though if you are brand new to them it will probably take more than this to start getting comfortable with them. If you have specific questions about things feel free to post them but(and I don't mean this rudely), it's unlikely someone is going to go very in depth explaining a basic mathematical tool like vectors. J On 1/19/07, Mukkan Yhtiö <[EMAIL PROTECTED]> wrote: > > Hi, > > Could some one explain how Vector Vatriables work? As far as I know they > hold (x, y and z) coordinates? > > If I wanted to manually manipulate a Vector Variable in game I need to > know > how they work mathimatically? What they hold entirely and how to > manipulate > them in a 3D environment. > > I assume when manipulating 3D objects in a 3D environment you use yaw, > pitch > and roll as well as x, y and z? > > If anyone could briefly explain all this to me I would be eternally > greatfull. > > Thanks. > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > -- _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

