|
| |||||||
| Wiremod Tutorials Post your wiremod tutorials/guides here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Wire Guru ![]() ![]() Join Date: Jul 2007 Location: Dallas, Texas
Posts: 536
![]() | EDIT: This is a request.. forgot to tag the topic title. I'm completely mystified by vectors. And I'm not just talking about vector thrusters, I'm talking about all the related functions and terminology (scalar, cross product, dot product, axis aligned velocity, up/down/forward vector, vector normalize, etc). From the documentation: Code: vector(x, y, z) : Create a vector for use with these functions vecx(v) : X component of the vector vecy(v) : Y component of the vector vecz(v) : Z component of the vector vecpitch(v) : Pitch for the vector vecyaw(v) : Yaw for the vector veclength(v) : Length of the vector vecnormalize(v) : Normalize the vector vecadd(v1, v2) : Add two vectors vecsub(v1, v2) : Subtract two vectors vecmul(v1, v2) : Multiply two vectors vecsmul(v1, n) : Multiply a vector by a scalar vecsdiv(v1, n) : Divide a vector by a scalar vecdot(v1, v2) : Dot product of two vectors veccross(v1, v2) : Cross product of two vectors vecdistance(v1, v2) : Distance between two vectors extcolor(r, g, b) : Sets the color, 0-255 extcolor(r, g, b, a) : Sets the color, 0-255 extcolorr() : Returns the color (red component) extcolorg() : Returns the color (green component) extcolorb() : Returns the color (blue component) extcolora() : Returns the color (alpha component) extposx() : Returns the position (x coordinate) extposy() : Returns the position (y coordinate) extposz() : Returns the position (z coordinate) extpos() : Returns the position (vector) extvelx() : Returns the velocity (x coordinate) extvely() : Returns the velocity (y coordinate) extvelz() : Returns the velocity (z coordinate) extvel() : Returns the velocity (vector) extvelabsx() : Returns the axis aligned velocity (x coordinate) extvelabsy() : Returns the axis aligned velocity (y coordinate) extvelabsz() : Returns the axis aligned velocity (z coordinate) extvelabs() : Returns the axis aligned velocity (vector) extdirfwx() : Returns the forward vector (x component) extdirfwy() : Returns the forward vector (y component) extdirfwz() : Returns the forward vector (z component) extdirfw() : Returns the forward vector (vector) extdirrtx() : Returns the right vector (x component) extdirrty() : Returns the right vector (y component) extdirrtz() : Returns the right vector (z component) extdirrt() : Returns the right vector (vector) extdirupx() : Returns the up vector (x component) extdirupy() : Returns the up vector (y component) extdirupz() : Returns the up vector (z component) extdirup() : Returns the up vector (vector) vecrotate(v, p, y, r) : Rotate a vector using pitch, yaw and roll I watched revan's vector thruster tutorial and it explained almost nothing, just a tutorial how to build a particular contraption. We need something in-depth about vectors here. I know there are many other people here as confused as I am about it all. |
| | |
| Sponsored Links | |
| | #2 (permalink) |
| Advanced Member ![]() Join Date: Jan 2008
Posts: 176
![]() | if you know what a vector is , thats a start. anyway, a vector is a line in a direction, with x,y,z parameters. coordinates you use all the time with GPS, is jst teh direction vector to that point from teh origin cross product between two vectors will give you the perpindicular vector to each. scalar product of two vectors is this is this Cos(angle betweenthem) = scalarproduct/(magnitudeofvector 1 *magnitude of vector 2) Last edited by Whodunnit; 09-29-2008 at 10:28 PM.. |
| | |
| | #3 (permalink) |
| Member ![]() Join Date: Jul 2007 Location: Norfolk, VA
Posts: 73
![]() | Vector physics is complex. I am on a quest to better understand this field as well, and have been searching for answers in much the same way with very similar results. Here is an article that helped me understand it a little better. A vector is an object that has both direction and length. One important thing to remember is that a vector has a major component known as velocity, which is speed and direction. Example: 5 mph North. In what I have learned so far (which is not much, I admit) you would use vectors when determining direction, distance, and location that is relative to either a particular entity (a contraption, or a vehicle) or the player. If you want to go left, your position afterward would be relative to the direction you are facing. You would get that direction by getting the forward vector: Code: Forward = extdirfw() Revan's vector thruster tutorial did show one thing I found useful, and that was how he got the vector between the contraption and the target. He did that by subtracting the base of the vector (the point of the local GPS) and the tail of the vector (the locator) I would recommend reading that article in doses you find manageable. I initially found it rather daunting but a worthy challenge, and have found its benefits encouraging. I wholeheartedly agree though that we should have some much better descriptions of this field - with examples of applications that people have found useful.
__________________ "Not everything that counts can be counted, and not everything that can be counted counts." -Sign hanging in Albert Einstein's office at Princeton Has the LHC Destroyed the Earth? |
| | |
| | #4 (permalink) |
| Wire Dev - Thruster God ![]() | the vector functions of the expression gate 1, is only experimental, and can't really be used for anything else than calculations within the gate. also the syntax: vecadd(vector(X,Y,Z),vector(0,0,64)):normalize() ect..... is highly inefficient, but this will be much better with expression 2. ![]() But really. Vectors are only for those who have knowledge within them.
__________________ Everything can be improved upon. Nothing is Perfect. The only way to move forward, is to surpass what has already been done. Creator of many things. |
| | |
| | #5 (permalink) |
| Wire Guru ![]() ![]() Join Date: Jul 2007 Location: Dallas, Texas
Posts: 536
![]() | Thanks for the replies. I started to sort of skim the wikipedia page and I think I'm starting to understand it a little bit. Keyword little. One thing I'm not understanding, is that if you create a vector(x,y,z) (which is only one point in 3d space), how does vecyaw(), veclength(), vecpitch(), etc know how to determine the values? You can't determine yaw, pitch, or length with only one point. Now, I would understand if you feed a vector thruster an X,Y,Z.. it would know where to point to because it has two coordinates: one of them where the thruster is, one where the values you input are. From there it can determine which way to point (am I on track here?). But for basic calculations, I don't see how you could possibly find the veclength() for example with a single point. i.e. V=vector(10,20,30) Length=veclength(V) <-- makes no sense to me Last edited by Beer; 09-30-2008 at 01:30 AM.. |
| | |
| | #6 (permalink) |
| Wire Dev - Thruster God ![]() | you are forgetting that vectors are not as simple as single points. they can be the difference between 2 points, movement, and a lot of other things. the pitch and yaw is found from the world. it is the difference of angles between the (1,0,0) vector of the world, and the vector that you have. Vectors are really useful, but they require that you know how to use them. also the length of a vector can be found via. X^2+Y^2+Z^2=Length^2 so vector(10,20,30) would equal 30 in length 10*10+20*20+30*30 = 900 square root of 900 is 30
__________________ Everything can be improved upon. Nothing is Perfect. The only way to move forward, is to surpass what has already been done. Creator of many things. Last edited by Shandolum; 09-30-2008 at 01:50 AM.. |
| | |
| | #7 (permalink) | |
| Wire Guru ![]() ![]() Join Date: Jul 2007 Location: Dallas, Texas
Posts: 536
![]() | Quote:
"Vectors are really useful, but they require that you know how to use them." Gotta start somewhere. ![]() EDIT: Since you edited and added some extra text (which was very helpful).. let me take a stab at something. If, instead of entering coordinates, I entered velocity (or the absolute of rate of change) along the X, Y and Z axis, the vector of those values would be the overall 3D velocity in any direction. Which would essentially be like a speedometer. Am I right? Last edited by Beer; 09-30-2008 at 02:05 AM.. | |
| | |
| | #9 (permalink) | |
| Wire Guru ![]() Join Date: Mar 2007
Posts: 2,033
![]() | Quote:
Another important thing is to understand that a direction vector only specifies the pitch and yaw (or properly, elevation and bearing), not the roll, but roll cannot be determined from a vector. So, in a nutshell, vectors define position or movement in space, and provides the means of transforming between these two. So if you have two vectors, and do "A-B" you will get a vector that describes the direction from A to B. Another common use is if you want to extract the three axis vectors of a ship, then it is enough to only have two, then you take the cross-product of those two vectors and you get the third. The rest is just about understanding the possibilties of vectors and how they are used. | |
| | |
| | #10 (permalink) |
| Wire Guru ![]() ![]() Join Date: Jul 2007 Location: Dallas, Texas
Posts: 536
![]() | Ok, I'm starting to catch on. I made my first simple vector contraption. And it actually worked on the first try and did exactly what I expected. Basically, it's just two melons (so you can see them) with a GPS welded to them. Two vectors are created with the coordinates of each GPS, then subtracted to produce a direction vector. Doing this, I can create a vector thruster that fires in a direction relative to the 2 melons. Didn't feel like waiting for youtube to process a video, so here's a gif: ![]() I'm beginning to understand. I do still think there needs to be an in-depth tutorial on the subject though for everyone to use. |
| | |
| Sponsored Links | |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|