Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What exactly is the difference between a Vector and a Point?

so as I was messing around with Cframes, I came around an intriguing question ,what's the different between a Vector and Point?..

methods like CFrame:PointToWorldSpace() takes a point, and return another point in world space..

so why is this important?

well the thing is, as i was messing around studio I tried to offset a part(partB) 5 studs on the Z axis relative to another part( partA), I tried doing partB.Position = partA.CFrame:VectorToWorldSpace(Vector3.new(0,0,5)).. However, that placed partB 5 studs(on the Z axis) from the world origin, Vector.new(0,0,0). so I tried using partA.CFrame:VectorToObjectSpace(Vector3.new(0,0,5)) instead, and it didn't work either..so being persistant, I decided to use partA.CFrame:PointToWorldSpace(Vector3.new(0,0,5)), and it work - it positioned partB 5 studs from partA.. However, to be a programmer, or of any professional field, is not to "guess" about what to do, which lead me to hunt on the difference between a a vector and a point..

i think i should now mention that I have surface Idea of the 2 concepts, such as a vector has a direction, and a point is just a point in space, however, On MathStackExchange, someone put it this way.. <3, 2> is a vector because it indicates going up 3 studs, and 2 to the right.. The problem with this however, is that points can be interpreted that way too.. for instance, someone might say <4,2> is a point because, however, another person could interpret it as going up 4, and 2 to the right...

now I am in a state of confusion, and have had to postpone the development of a game I am working on because of this issue.. I've researched, and this is the only other place i have in mind

3 comments

2

A 3,2 point is 3 on the x and 2 on the y. A 3,2 vector is 3 on the x and 2 on the y; except a 3,2 point is only relative to 0,0. A 3,2 vector can only be between two points.

2

Think of it as being displacement vs movement. If I told you to go to 3,2 that's the point I'm telling you to go, if I said move 3,2 that's your vector. I'm sure there's a better/more pedantic/rigorous answer but this is how I see it.

0

ooooh that makes much more sense now

1 answer

I feel like this is best done with a visualization of these two things. A vector, classically, is a line pointing out from an origin in a single direction. A point, classically, is a point in space that is placed in relation to the origin.

A vector in this case is meant to show direction and/or movement. (in the form of displacement) A position is meant to be a point in space.

Now, they can be used together in this scenario because they both use the Vector3 object in Roblox.

Some examples include: CFrame.LookVector --This is where the Cframe is 'looking', aka the direction (but keep in mind its not calculated with the CFrames origin, its simply the displacement from the origin of the Cframe) Part.Position --This is the CFrame's position around the origin, it does not describe the direction the cframe is looking or any of it's rotational values. ^^Both of these properties are mutually exclusive in functionality, but both use Roblox's Vector3 objects. I hope this answers your question.

This discussion is preserved as it was. New answers, comments, and votes are closed.