Adding "cross" to the class Vector3?

Hi! I had a javascript code, written with ThreeJS with this line:
var right =up.clone().cross(forward).normalize();

For Babylon, I was forced to change to:
var right = BABYLON.Vector3.Cross(up.clone(),forward).normalize();

Could the “cross” function get added to the class Vector3?
I could do and test it in Github, if this is ok.


Unity also uses static vector math functions, but I can understand that it makes porting code between Three and Babylon just that bit more frustrating.

It should be pretty trivial to add a class function that calls the static implementation, however.

Looking forward to the PR :slight_smile:

PR? I am new to Github :-/
I have to banch, edit, test and do merge-request, hm?
As I do not know how to build BABYLON after editing to test it,
I did it this way, and it worked fine:

BABYLON.Vector3.prototype.cross = function(withThat) {
return BABYLON.Vector3.Cross(this,withThat)

Could someone add this to BABYLON or help me?

I will no worries :slight_smile: (even though I encourage you to learn how to contribute: Start Contributing to Babylon.js - Babylon.js Documentation


Oh, what a detailed description! Even most of the geeg abbreviations are explained.
Well, I only have to learn a new langugage Typescript), install a hand full of tools (Visual Studio, node.js and NPM, Typescript and Gulp=?). :-/

Fist I made a branch online at
I did not even find the class Vector3 firstly, but in the master branch.
The source did not look different from Javascript, is it?
So I could just edit my cross into it, and do the merge request.
But “cross” was already added by Deltakosh!
And it is in the documentation too.
Thank you.


1 Like