rovector3

1.0.7 • Public • Published

RoVector3

This package is a JS implementation of Roblox's Vector3 Class.

Install

npm install rovector3 --save

Usage

Once you've installed the package you can simply add it to your code:

const CFrame = require('rovector3');

The great part about this package is that it functions similarly to Roblox's. However, since JS does not support operator overloading there are methods built into Vector3s as substitutes.

Addition
const Vector3 = require('rovector3');
 
let a = Vector3.new(0,0,0);
let b = a.add(Vector3.new(5,0,0));
Subtraction
const Vector3 = require('rovector3');
 
let a = Vector3.new(0,0,0);
let b = a.sub(Vector3.new(5,0,0));
Multiplication
const Vector3 = require('rovector3');
 
let a = Vector3.new(0,0,0);
let b = a.mult(Vector3.new(5,0,0));
Division
const Vector3 = require('rovector3');
 
let a = Vector3.new(0,0,0);
let b = a.div(Vector3.new(5,0,0));
Dot Product
const Vector3 = require('rovector3');
 
let a = Vector3.new(3,2,1);
let b = a.Dot(Vector3.new(5,0,0));
Cross Product
const Vector3 = require('rovector3');
 
let a = Vector3.new(5,12,2);
let b = a.Cross(Vector3.new(5,0,0));
Interpolation
const Vector3 = require('rovector3');
 
let a = Vector3.new(0,0,0);
let b = a.Lerp(Vector3.new(5,0,0),0.75);
Unit
const Vector3 = require('rovector3');
 
let a = Vector3.new(90,2,4).unit();

Readme

Keywords

Package Sidebar

Install

npm i rovector3

Weekly Downloads

1

Version

1.0.7

License

ISC

Unpacked Size

4.75 kB

Total Files

3

Last publish

Collaborators

  • spookshd