# How to get the three vector coordinate of a vector3 separately ?

## Recommended Posts

Hi,

I get an array with all the vertex coordinates of a plane. (P0x, P0y, P0z, P1x, P1y, P1z, …)

Then, with the function Vector3.toArray(array, index) I can make a vector3 from the indicated index.

For example :

var array = [P0x, P0y, P0z, P1x, P1y, P1z,P2x, P2y, P2z, P3x, P3y, P3z];

var vector =BABYLON.Vector3.FromArray(array, 3);

So, my vector is : {x, y , z} => {P1x, P1y, P1z);

But ! I would like to do the opposite. If I have a Vector3 and I want set its values in the array which contains all vertex coordinates I have to decompose the vector into three value. How to do that ? How to get the three vector coordinate separately ?

Thanks.

##### Share on other sites

asArray() returns the coordinates as a new array object

toArray(existingArray) append the coordinates to an existing array

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.