Vertex positions & normals

var vertexes = [];
entity.model.meshInstances[0].mesh.getPositions(vertexes);
var normals = [];
entity.model.meshInstances[0].mesh.getNormals(normals);

What kind of data writes in vertexes and normals?
I’m trying window.tools.obj2Vec3 = function(obj) { return new pc.Vec3(obj.x, obj.y, obj.z); }; to get vector, but have zero vector

Hi @KpoKec,

What is obj2Vec3?

Take a look at the following example on how those two arrays can be populated manually:

https://playcanvas.github.io/#graphics/mesh-generation.html

1 Like

Better been edit docs like this:

getPositions(positions) []
Gets the vertex positions data (ex [vertex1.x, vertex1.y, vertex1.z, vertex2.x, vertex2.y, vertex2.z, …]).

1 Like
window.tools.obj2Vec3 = function(obj) { return new pc.Vec3(obj.x, obj.y, obj.z); };

convert object with x/y/z fields to pc.Vec3 (I have same for Vec2 & Quat)

1 Like