Powerlang Docs
  • Welcome!
  • Beginner's Guide
    • Syntax
    • Directives
    • Environment
    • Special types
    • Functions
    • Tables
    • Loops
    • Conditions
    • Events
    • Libraries
    • Comments and Flags
  • Creating a Game
    • Project Introduction: Potato Rush
    • Creating the main game loop
    • Creating potatoes
    • Keeping track of score
  • Libraries
    • Special Types
      • BrickColor
      • CFrame
      • Color3
      • Instance
      • NumberRange
      • UDim2
      • Vector2
      • Vector3
    • Services
      • DataStore
      • Debris
      • Mouse
      • Pathfinding
      • PhysicsService
      • Players
      • Ray
      • TweenService
    • compiler
    • math
    • os
    • string
    • table
    • retrostudio
  • Advanced Information
    • Instance Functions
    • Global Functions
    • Multithreading
    • Compiler Library
Powered by GitBook
On this page
  1. Libraries
  2. Special Types

Vector3

Function
Description

new(X: number, Y: number, Z: number) -> Vector3

Creates a new Vector3 object with the specified X, Y, and Z coordinates and returns it. Requires three arguments.

split(Vector3: Vector3) -> X: number, Y: number, Z: number

Splits a Vector3 object into its X, Y, and Z components and returns them as separate outputs.

magnitude(Point1: Vector3, Point2: Vector3) -> Distance: number

Calculates the distance between two points represented by Vector3 objects and returns the distance as a number.

rotation(Point1: Vector3, Point2: Vector3) -> RotationVector3: Vector3

Calculates the rotation vector between two Vector3 points and returns it as a new Vector3.

normalize(Vector3: Vector3) -> Result: Vector3

Normalizes the given Vector3 and returns the normalized result as a new Vector3.

dot(VectorA: Vector3, VectorB: Vector3) -> Result: number

Computes the dot product of two Vector3 objects and returns the result as a number.

cross(VectorA: Vector3, VectorB: Vector3) -> Result: Vector3

Computes the cross product of two Vector3 objects and returns the result as a new Vector3.

PreviousVector2NextServices

Last updated 8 months ago