Skip to content

BigChungus21220/Vector-JS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project logo

Vector JS


Provides vector operations and conversions for Minecraft Bedrock scripting (although it should work for anything).

🏁 Getting Started

Copy Vector.js into your Scripts folder (bp/scripts) and put import { vec3 } from 'scripts/Vector.js'; at the top of your script

Code examples

Creating and adding two vectors

let a = vec3(1,2,3);
let b = vec3(4,5,6);
b = a.add(b);
console.log(b);

Making a 10 unit long 2d vector

let a = vec2(1,2);
console.log((a.normalized).multiply(10));

Getting the normal of a triangle

let a = vec3(1,3,0);
let b = vec3(4,5,2);
let c = vec3(2,-5,6);
let normal = a.subtract(c).cross(b.subtract(c)).normalized;

✍️ Authors

About

Vector Library for Minecraft Bedrock Edition

Resources

License

Stars

Watchers

Forks

Packages

No packages published