Vector3 x,y,z are accessors, vector2 x y are properties

I see that in vector3, x,y,z are accessors

When did this happen?
assessors are hard to serialize

In vector2 and vector4 these are properties

it’s because the setter on vector3 marks as dirty.
Babylon.js/math.vector.ts at master · BabylonJS/Babylon.js (github.com)

vector2 are public properties (not backed by a private _x)
Babylon.js/math.vector.ts at master · BabylonJS/Babylon.js (github.com)

Has this been this way since the beginning ?
I was trying to serialize this and it wasn’t working which is when I noticed this.

I am assuming the same logic could eventually be applied to vector2 and 4.
Somebody might want to track changes to them and might decide to make them accessor too.

No, I think this is a change since 4.2 and corresponds to this entry in the “what’s new” file:

* Improved world matrix caching engine by using dirty mechanism on vector3 and quaternion ([Deltakosh](https://github.com/deltakosh))
1 Like