# Vectors?

Can someone brief me on vectors? I’m currently trying to learn particles and effects and need to learn this before I can start - often in scripts I have seen these mystical numbers, I know well that they are used to define a position in the (x,y,z) format but don’t get any further than that. How are they also used as directions and angles?

Last but not least, where would I need to start with this in order to make a custom 3d effect? (AKA a plasma ball or something that’s not a sprite)

For 3D effects I suggest you learn up on particles :

http://www.roosl.com/images/xyz.gif

thats the best pic i can find, X Y and Z
X is horzinal
Z is vertical
Y if forward/downwards

trugh i would work whit 2d first, since 3d is a bit harder ^^
like painting HUD and such

correct.

3d2d isn’t that horrible.

He means the 3D and 2D spatial concepts, not the Cam functions.

I don’t think he did.

Painting on the HUD involves using 2d vectors.
It doesn’t involve the cam functions.
I think he did.

i did flapjack, just stop arguing, youve been perma banned 5 times do you want to get a 6th time already?

That’s a 3D coordinate system, not a vector.
A vector describes a direction. Although, vectors in GMod lua are also used to describe points in the coordinate system (then only the head is used).

A vector has a tail and a head. You can think of a vector like an arrow. The tail of the vector “arrow” begins at coordinate (0, 0(, 0)) in the coordinate system. The head of the “arrow” is at any other coordinate. Imagine an arrow between these two coordinates and you’ve got a direction. The length between the two coordinates is the magnitude.

I’m not arguing, I made a statement. Also, don’t threaten me. I’ve already talked with the moderators about my number of bans, as long as I keep my toes in line I will not be permabanned a 6th time.

If you wanted to insult me, you could have done it a lot better. For example: “Go back to being banned”

[editline]09:46PM[/editline]

It doesn’t involve vectors. It has a position, but not a direction or magnitude.

To clear up any confusion:

Inb4: I know I misspelled vertical.

(15,18) is a vector. It means 15 up and 18 along. It has a magnitude of 23.430749 and a direction that I can’t be bothered to work out but is probably about 50 degrees.
Co-ordinates are a type of vector: Cartesian Form describes them in component form and Polar Form describes them as a magnitude and direction.

In gmod there are two main types of vectors: local and world.

A local vector is a vector relative to an object. For example, let’s use the following vector:
Vector( 0, 0, 10 )
Relative to you, that vector is ten units above you. Its magnitude (length) is 10, and its direction is up.

On the other hand, a world vector is a vector relative to the map’s “origin”. So the same vector of (0, 0, 10) would still be the same length and direction, but it refers to a spot above the map origin. In terms of world vectors, we could turn that local vector into a world vector relative to you by saying:
vec = you:GetPos() + Vector( 0, 0, 10 )

When do we start to use angles?

when your turing things, like looking a drifrent way or rotating an object,
yaw, roll and pitch

So angles only deal with turn and don’t help with location.

Yes