Get x,y,z co-ordinates of vertices

tomslater's icon

Hello,

I'm making my own .obj files in Sketchup and then opening them in Jitter with jit.gl.model.

Let's say I start with a simple, wireframe cube -

I want to get the x,y,z co-ordinates of the cube's 8 vertices and have them updated as the cube moves in 3D space.

I then want to map the co-ordinates of the moving vertices to a panning algorithm.

Does anyone know how to get these co-ordinates and have them updated in real time?

Thanks

Rob Ramirez's icon

you can output a matrix containing transformed vertex positions of a model using jit.gl.model @matrixoutput 2

note that enabling matrixoutput mode will prevent the model from drawing in the context, so either duplicate by using another jit.gl.model object, or use the matrix-output vertices with something like gl.mesh.

tomslater's icon

Thanks Rob,

I'm getting somewhere.

Could you tell me how I format the matrix output? What the list is made up of?

I've tried attaching a message box to see what the list looks like but the patch crashes every time I do that.

For now I have attached a pwindow (see patch) which I think shows the x,y,z co-ordinates expressed as colour values. This looks nice but, I need to identify a vertex and track its x,y,z co-ordinates in numbers.

Max Patch
Copy patch and select New From Clipboard in Max.

Any clues much appreciated.

Rob Ramirez's icon

just depends what you want to do with the values.
jit.iter or jit.spill are probably what you want to look at.

Max Patch
Copy patch and select New From Clipboard in Max.
tomslater's icon

Thanks Rob, I'm making some headway