Overwrite new BABYLON.Vector3.X

just a simple question sometimes i see new BABYLON.Vector3.whatever
how would i overwrite that with new propeties?

Can you give a concrete example? I don’t understand your question.

so you want to add a prototype to Vector3?

you can do

BABYLON.Vector3.ThingIwantToAdd = class{


for example you want a vector that is added to a constant or something:

BABYLON.Vector3.prototype.QuickMaths = function(v){
return v.add(new BABYLON.Vector3(2,2,2));

an example would be
points.push( new BABYLON.Vector3(i - 25, 5 * Math.sin(i / 2), i /5 * Math.cos(i / 2)) );
how would i modify this later?

Is this what you’re asking?

const myVector = new BABYLON.Vector3(i - 25, 5 * Math.sin(i / 2), i /5 * Math.cos(i / 2)) 

myVector.x += 5

it gets pretty close but i rather overwrite the whole myVector
a other sample would be this

redball.material = red; if i would like to have blue as the color
i could make a second color call it blue and do redball.material = blue;
but thats not my point i rather edit red to use a blue color if you know what i mean

points[id].x = ?

you can access the array that you are making later and then access the xyz parameters if you select one of your points.

or mat.emissiveColor = ...

points[i] = new vector3?

If you are pushing them into an array, you can access them and modify them all you want later if you know which one you are trying to access ID.


myVector.set(-1, 2, Math.PI / 4)

??? Getting closer?

my apoligize for inacitvity :frowning: