1.0.4 • Published 6 years ago

cframe v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

This package is a JS implementation of Roblox's CFrame Class. This allows you to transform and rotate 4x4 matrices and far more.

TODO:

  • Add fromMatrix
npm install cframe --save

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

const CFrame = require('cframe');

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 CFrames as substitutes.

Addition
const Vector3 = require('rovector3');
const CFrame = require('cframe');

let a = CFrame.new(0,0,0);
let b = a.add(Vector3.new(5,0,0));
Subtraction
const Vector3 = require('rovector3');
const CFrame = require('cframe');

let a = CFrame.new(0,0,0);
let b = a.sub(Vector3.new(5,0,0));
Multiplication
const Vector3 = require('rovector3');
const CFrame = require('cframe');

let a = CFrame.new(0,0,0);
let b = a.mult(Vector3.new(5,0,0));
let c = a.mult(CFrame.new(5,0,0));
Rotation
const CFrame = require('cframe');

let a = CFrame.new(5,10,2).mult(CFrame.Angles(0,Math.PI/3,0));
console.log(a.toOrientation());
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago