Forums > Jitter

Get x,y,z co-ordinates of vertices

March 25, 2014 | 8:20 am

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


March 25, 2014 | 3:15 pm

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.


March 26, 2014 | 12:08 pm

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.

Any clues much appreciated.

<code>

– Pasted Max Patch, click to expand. –

</code>


March 26, 2014 | 2:17 pm

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

– Pasted Max Patch, click to expand. –

March 29, 2014 | 9:10 am

Thanks Rob, I’m making some headway


Viewing 5 posts - 1 through 5 (of 5 total)