|
| 26 Feb 2014 06:51 PM |
I'm an advanced scripter and really want to do things with lookVector, but I still don't get it lol. I know that it is the facing direction of the front surface of the part, but thats a line of points, not a single point, and lookVector seems to be a single point, and not at all a point near the part itself.
Can someone possibly write a script that draws a line of parts where the lookVector ray is? Or at least explain it to me better, because I don't get it at all lol.
Is lookVector a ray or a point? It sounds like a ray from the definition of "facing direction", but it seems like a point when I print it.
Please help! Thanks! |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2014 06:53 PM |
It is the vector upond which it is facing.. But it is a normalized vector so to get it you have to do:
function check(part) vector = part.CFrame.lookVector * 3 return vector end |
|
|
| Report Abuse |
|
|
|
| 28 Feb 2014 09:17 AM |
I still don't get it lol. Wouldn't the Vector the part is facing be only 2 studs ahead of it (assuming that the part is the default size) be the vector that the part is facing? I'm definately missing something...
Is it like a ray going forward from the parts front surface? If so, how can that be a single vector? |
|
|
| Report Abuse |
|
|
|
| 28 Feb 2014 09:19 AM |
| It's a 3D Vector. it has a direction and a magnitude > Vector. |
|
|
| Report Abuse |
|
|
|
| 28 Feb 2014 10:20 AM |
| Vectors are positioning. How can they have a direction (sorry, Im trying to understand this :P)? |
|
|
| Report Abuse |
|
|
|
| 28 Feb 2014 10:23 AM |
What grade are you in? You will learn this later. |
|
|
| Report Abuse |
|
|
|
| 28 Feb 2014 10:38 AM |
| Can you help instead of criticize? Thanks. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 01 Mar 2014 10:50 AM |
If you don't know lookVector you probably aren't an advanced scripter. Anyways, I'd be glad to help.
Just think of lookVector as the angle the front surface of a part is facing. Now you might question how this would help anything, but it does.
Say we want to launch a part out of a cannon. So the cannon is Cannon
Cannon=part
and the ball is Ball
Ball=part
We could do something like
Ball.Velocity=Cannon.CFrame.lookVector*100
Putting the lookVector would make the velocity push the part in the direction the cannon is facing, but wouldn't be enough power to push the part so that's why I multiplied it by 100.
Hope I helped. |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2014 11:08 AM |
Thanks I sorta get it now :P.
I've done or can do pretty much everything with ROBLOX scripting period besides lookVector stuff and body objects, I've done a bit with body objects, but I have to look up the properties. I consider myself to be an advanced scripter because I've used almost every object that is most used besides above, including advanced motor animations using C0. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 07 Mar 2014 05:41 PM |
You have to be able to differentiate between Points and Vectors. Once you understand the difference, you'll understand the use of lookVector.
That said, I rarely ever use lookVector in my projects. |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2014 02:11 PM |
Ahhhh ok. What is the difference between points and vectors :P?
There have been many things that I've wanted to do that I think require lookVector, such as getting the player to look where the mouse is. Is that doable without lookVector? |
|
|
| Report Abuse |
|
|
| |
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 15 Mar 2014 12:23 PM |
| A point is nothing more than a location. You are confusing vectors with them, because when you use a vector you only think of the location you are assigning it. A vector has direction and magnitude (length). The "location" you use to create a Vector3 is only the end point of the vector, which runs from the origin to the end point. Pythagorean theorem gives you the magnitude and some basic trigonometry can give you the angles. It's just easier to specify the vector using its end point. |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 15 Mar 2014 12:27 PM |
| A part's lookVector is the vector relative to the part's center (treating the part's center as the origin now, instead of (0,0,0)) that is in the direction of the part's front surface (hence LOOK vector). Therefore, if you want to move a part forward relative to its current rotation, all you need to do is add its lookVector to its center. I would find some examples of vector addition on the internet if my last sentence did not make sense. |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2014 09:51 AM |
| OHHHH So vectors are like the position and where they are facing, and the position is just the position (obviously lol). I sorta get it :P. |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2014 08:25 AM |
| Vectors also have a definite length. |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 01:40 PM |
| Oh, so they are like rays? |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 11:49 PM |
They're more like line segments, except they flow from one endpoint to the other. So, in terms of line segments:
Line Segment: Points A, B (A-B) == (B-A)
Vector: Points A, B (A-B) ~= (B-A)
(A-B) == -(B-A) :. (B-A) == -(A-B)
Because A-B ~= B-A, but -(A-B) == (B-A), we know there is some kind of direction involved. If you write A-B, the vector flows from point B TOWARD point A. If you write B-A, the vector flows from point A TOWARD point B. These two vectors are DIFFERENT, even though they have the same length and lie on the same 3D line. |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 19 Mar 2014 02:40 AM |
Uuuh... A vector represents a point or location... There's no difference... -_- Although, a vector can calculate the distance from a specific point to (0,0,0) and can devide the coordinates of that point by that distance. But seriously. Its just a value with 3 numbers... It represents a point or location... |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 19 Mar 2014 02:44 AM |
| And I dont know what you mean with A - B = B - A and line sequence, but since B - A = -A + B, I can say that that statement will NEVER be true... |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2014 02:51 AM |
I tried to explain the line segment with that equation. Wasn't a very good example, was it ...
>_<
Off to bed with me before I do stupid stuff like that again. |
|
|
| Report Abuse |
|
|