LogoLogo
Join The CommunityCommunity ResourcesLuafaq.orgLua Org
  • Welcome
  • Frequently Asked Questions (FAQ)
  • Legacy API
    • Test The API
    • Warning
    • Character
      • v1/wear
      • v1/remove
    • Games
      • v1/games/details
    • User
      • v1/user/request-data
      • v1/user/avatar
      • v1/user/get-by-username
      • v1/user/get-token
      • v1/user/verify-password
      • v1/user/login
      • v1/user/chat/send-message
      • v1/user/chat/chat-summary
      • v1/user/get-messages
      • v1/user/chat/chats
      • v1/user/friends
      • v1/user/friend
      • v1/user/search
    • Guild
      • v1/join
    • Asset
      • v1/sell
      • v1/take-offsale
      • v1/purchase
      • v1/purchase-reseller
      • v1/create
      • v1/get
  • OPEN CLOUD
    • READ ME
    • NPM Package
      • Introduction
      • Tutorials
        • Webhook Configuration
      • Bot Account
      • OpenCloudClient
      • WebAPICliet
        • Client
        • login
        • quit
        • Friends Endpoint
          • SendFriendRequest
          • GetFriends
        • User Endpoint
          • GetAvatar
          • GetPlayerByUsername
        • Guild Endpoint
          • JoinGuild
    • Open Cloud
    • Webhooks
    • Asset Types
    • Beautiful JSON Display
    • V2 API
      • Asset
        • Edit
      • Publish
        • Asset
        • World
      • Feed
        • reply
        • all/{page_cursor/{feed_cursor}
      • Cloud
        • oauth
          • create
        • git/{channel}
        • version
        • database
          • get
          • set
        • credentials
          • list
          • delete
          • create
        • bricklinks
          • list
          • delete
          • create
      • Webhook
        • delete
        • create
        • list
      • User
        • feed
          • send
        • search
        • register
        • login
        • username-available
        • email-available
        • phone-available
        • validate-beta-key
        • id
        • username
        • edit-setting
        • transparency-request
      • Auth
        • send-beta-key
        • get-active-sessions
        • terminate-session
        • get-token
        • session
        • is-authed
        • join-game
        • bot-login
      • Notifications
        • unread
        • all
        • erase
      • Worlds
        • /{universe}/{server}/server/metadata/update/{token}
        • /{universe}/shutdown/all/{token}
        • /{universe}/shutdown/server/{server}/{token}
        • /{universe}/join/server/{server_id}
        • /{universe}/join/random
        • /{universe}/join/user/{user_id}
        • /client/{join_key}
        • /create-universe/{ownerId}/{ownerType}
        • /create-world/{universeId}
        • /worldtree/{worldId}
  • Developer Guide
    • Empowering Responsible Gameplay: A Guide to ModerationService in BrickVerse
    • Empowering Game Creators: A Deep Dive into ENVService with Lua API in BrickVerse
    • Leveraging ENVService as an FFlag System
    • What's Authority?
    • Roblox Vs BrickVerse Classes
    • DRM - Digital Rights Management
  • BrickLua - Coding With Lua
    • Introduction
    • Learn Lua
      • Functions
      • Strings
      • Tables
      • Boolean
      • Conditional Structures
      • Opeartors
      • bit32
      • Numbers
    • Player Event
  • GAME API
    • API
      • Intro
      • math
      • debug
      • coroutine
      • Enum
        • UserInput
        • Humanoid
    • Classes
      • ServiceProvider
        • Enum
        • InteractionService
        • ENVService
        • Void
        • WorldstoreService
        • WorldSettings
        • DiscordRichPresence
        • ClientGui
        • AuthorityService
        • SharedStorage
        • WebService
        • RunService
        • NetworkService
        • AdService
        • UserInputService
        • Scene
        • ChatService
        • Lighting
        • SoundService
        • Players
        • ServerStorage
        • ScriptService
      • DataType
        • CFrame
        • Instance
        • Vector2
        • Vector3
        • Color
      • Dynamic
        • Dynamic3D
          • SpotLight
          • SpawnPart
          • Projection3D
          • PartMaterial
          • OmniLight
          • BasePart
          • InteractionPrompt
          • Page
          • DirectionalLight
          • Brick
          • BasePartConstraint
        • ScriptDynamic
          • ScriptModule
        • BaseUI
          • ScrollFrame
          • ImageButton
          • TextButton
          • ImageLabel
          • TextLabel
          • Frame
          • ViewportFrame
          • ScreenUI
  • Employment
    • List Of Administrators
Powered by GitBook
On this page
  • Constructors
  • Properties
  • Functions

Was this helpful?

Edit on GitHub
  1. GAME API
  2. Classes
  3. DataType

Vector2

In BrickVerse, the Vector2 datatype is often used in working with GUI elements and 2D mouse positions.

Constructors

Vector2.new ( number x, number y )

Returns a Vector2 from the given x and y components.

Properties

Vector2 Vector2.zero

A Vector2 with a magnitude of zero.

This API member is a constant, and must be accessed through the Vector2 global as opposed to an individual Vector2 object.

Vector2 Vector2.one

A Vector2 with a value of 1 on every axis.

This API member is a constant, and must be accessed through the Vector2 global as opposed to an individual Vector2 object.

Vector2 Vector2.xAxis

A Vector2 with a value of 1 on the X axis.

This API member is a constant, and must be accessed through the Vector2 global as opposed to an individual Vector2 object.

Vector2 Vector2.yAxis

A Vector2 with a value of 1 on the Y axis.

This API member is a constant, and must be accessed through the Vector2 global as opposed to an individual Vector2 object.

number Vector2.X

The x-coordinate of the Vector2.

number Vector2.Y

The y-coordinate of the Vector2.

number Vector2.Magnitude

The length of the vector.

Vector2 Vector2.Unit

A normalized copy of the vector.

Functions

number Vector2:Cross ( Vector2 other )

Returns the cross product of the two vectors.

number Vector2:Dot ( Vector2 v )

Returns a scalar dot product of the two vectors.

Vector2 Vector2:Lerp ( Vector2 v, number alpha )

Returns a Vector2 linearly interpolated between this Vector2 and v by the fraction alpha

Vector2 Vector2:Max ( Tuple others... )

Returns a Vector2 where each component is the highest among the respective components of the provided Vector2s.

Vector2 Vector2:Min ( Tuple others... )

Returns a Vector2 where each component is the lowest among the respective components of the provided Vector2s.

PreviousInstanceNextVector3

Last updated 3 years ago

Was this helpful?

print(Vector2.zero) --> 0, 0
print(Vector2.one) --> 1, 1
print(Vector2.xAxis) --> 1, 0
print(Vector2.yAxis) --> 0, 1
local a = Vector2.new(1, 2)
local b = Vector2.new(2, 1) 
print(a:Max(b)) -- Vector2.new(2, 2)
local a = Vector2.new(1, 2)local b = Vector2.new(2, 1) 
print(a:Min(b)) -- Vector2.new(1, 1)