# Autofill Maths Constructors

**URL:** <https://forum.babylonjs.com/t/autofill-maths-constructors/3658>\
**Category:** Feature requests\
**Created:** [June 2, 2019, 5:00pm UTC](https://forum.babylonjs.com/t/autofill-maths-constructors/3658 "2019-06-02T17:00:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [June 2, 2019, 5:00pm UTC](https://forum.babylonjs.com/t/autofill-maths-constructors/3658/1 "2019-06-02T17:00:24Z")

</div>

can we add something like:

```auto
constructor(
        /** 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)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [June 3, 2019, 2:35pm UTC](https://forum.babylonjs.com/t/autofill-maths-constructors/3658/2 "2019-06-03T14:35:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [June 3, 2019, 3:52pm UTC](https://forum.babylonjs.com/t/autofill-maths-constructors/3658/3 "2019-06-03T15:52:54Z")

</div>

Gotcha, I was wondering why the decision was made

---

<div class="post-metadata">

**Author:** ![MarianG](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mariang/32/138_2.png) [@MarianG](https://forum.babylonjs.com/u/MarianG)\
**Post date:** [June 3, 2019, 4:57pm UTC](https://forum.babylonjs.com/t/autofill-maths-constructors/3658/4 "2019-06-03T16:57:10Z")

</div>

As a workaround, maybe  
BABYLON.Vector3.One().scaleInPlace(yourvalue)

---

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [June 3, 2019, 5:04pm UTC](https://forum.babylonjs.com/t/autofill-maths-constructors/3658/5 "2019-06-03T17:04:33Z")

</div>

perhaps just a function 🙂

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

```

[https://playground.babylonjs.com/#938WF6#1](https://playground.babylonjs.com/#938WF6#1)
