generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: I still don't get lookVector...

Previous Thread :: Next Thread 
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
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
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
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
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
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
Kirbykid02 is not online. Kirbykid02
Joined: 18 May 2009
Total Posts: 2671
28 Feb 2014 09:19 AM
It's a 3D Vector. it has a direction and a magnitude > Vector.
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
28 Feb 2014 10:20 AM
Vectors are positioning. How can they have a direction (sorry, Im trying to understand this :P)?
Report Abuse
xxDARKSTERxx is not online. xxDARKSTERxx
Joined: 02 Nov 2010
Total Posts: 2358
28 Feb 2014 10:23 AM
What grade are you in?
You will learn this later.
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
28 Feb 2014 10:38 AM
Can you help instead of criticize? Thanks.
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
01 Mar 2014 09:35 AM
please help!
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
01 Mar 2014 10:44 AM
Bump please help!
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
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
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
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
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
03 Mar 2014 05:36 PM
Bump
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
07 Mar 2014 04:59 PM
Bumparoo
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
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
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
15 Mar 2014 12:11 PM
Bump
Report Abuse
killjoy37 is not online. 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 is not online. 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
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
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
Kirbykid02 is not online. Kirbykid02
Joined: 18 May 2009
Total Posts: 2671
17 Mar 2014 08:25 AM
Vectors also have a definite length.
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
18 Mar 2014 01:40 PM
Oh, so they are like rays?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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 is not online. 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 is not online. 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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image