<Vector3>.projectOnPlane is not a function

Hi, I’m reading the api docs for the Vector3 class and I’m looking to project a vector onto a plane, but I’m encountering this error for .projectOnPlane and .projectOnPlaneToRef

I’m trying to make a playground right now to showcase this error, but it is having trouble saving.

const normal = new BABYLON.Vector3(0, 5, -10);
const a = normal.x;
const b = normal.y;
const c = normal.z;
const d = 0;

const plane = new BABYLON.Plane(a, b, c, d);

const vec = (0, 5, -10);
const newVec = vec.projectOnPlane(plane, new BABYLON.Vector3(0, 0, 0));
console.log(newVec);

Hello this is because your vec is not a Vector3. This is what you need to do:

const vec = new BABYLON.Vector3(0, 5, -10);