Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What are vector2 values used for?

Asked by 5 years ago

Can't see any reason to use them when you have vector3. Could anyone give me some examples of when you use them and how to use it?

0
never used that before but maybe for 2D games? Louix27626 83 — 5y
0
vector2 is basically like vector3 but with only 2 axis. I never really needed to use vector 2 but heres a link to a wiki containing more info:https://developer.roblox.com/api-reference/datatype/Vector2 mantorok4866 201 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

In their most basic form, they're used to represent a point on a plane (a plane only consisting of only two dimensions). I found that they are most useful for passing into functions when you already know one of the three coordinates. For instance, if you were making a clone of Terraria on Roblox, but it was in 3D, you'd be creating every block with a z value of 0, so you'd only need a vector2 when spawning one in.

function CreateBlockAt(cords)
    --Create a block at (cords.x, cords.y, 0)--
end

<br> They can also be used for UI, but that should be a more obvious use.

0
Why are you encouraging somebody to get struck by copyright? Bad. DeceptiveCaster 3761 — 5y
0
I meant Terraria clone as in a genre of games, such as Terraria, Starbound, Planet Centauri, Junk Jack, etc... The creator of Terraria himself actually said that Terraria is a Minecraft clone, but obviously he meant he was simply inspired by Minecraft when he made it. Besides, I was not even encouraging to begin with, I said "if you were". davidgingerich 603 — 5y
Ad

Answer this question