Autofill Maths Constructors

can we add something like:

        /** defines the first coordinate */
        public x: number = 0,
        /** defines the second coordinate */
        public y: number = 0) {
    if(x !== null && y === null){
        this.y = x

And the same for like Vector3s and Color3s? I just find myself wanting to do BABYLON.Vector3(somevalue) all the time instead of BABYLON.Vector3(somevalue,somevalue,somevalue)

Unfortunately , we cannot add any test in the core math components because they can be instantiated thousand of times per frame

This is a place where perf is more important than easiness

1 Like

Gotcha, I was wondering why the decision was made

1 Like

As a workaround, maybe

perhaps just a function :slight_smile:

function uniformVector3(num) {
  return new BABYLON.Vector3(num, num, num);

1 Like