Obtaining position values of a translated, scaled, and rotated imported pShape

Hello! This is my first post on this forum, so please let me know if I’m not descriptive enough, etc.

When I’m referring to a pShape in this post, I am referring to an imported .obj file.

As you know, you can obtain the values of the position of a vertex of a pShape using .getVertex(), which will return three values (one for its x, y, and z position). However, after translating, rotating, or scaling that imported pShape using the .translate(), .rotateY(), etc., the position values of the vertex don’t change and they act as if the 3D model hasn’t moved from its origin (always returning the same values despite the translation).

To be sure, I used modelX(), modelY(), and modelZ() to check if I had done some sort of transformation on the coordinate space, but I had not.

Can anyone explain why this occurs or how I may get the position values of the vertex after I have translated my imported 3D model?

Thank you!

1 Like

last time i play with modelXYZ

it worked great, but possibly because it not used your object ( or only the center of a object )

but possibly you can use that code to demonstrate the problem
( or show your own example )

or i misunderstand, did you say that

not work on .obj files?

1 Like

.getVertex() does work on .obj files; that part I’m not having trouble with.

Unfortunately, I can only post one picture at a time because I’m a new user, so this is going to be a little harder to explain.

I start with a vertex of my .obj file on 0,0,0.

I move the .obj model by translating it, but it still returns a vertex value of 0,0,0.

I went back and tried .modelX(0,0,0) and it returned 0. .modelY(0,0,0) returned 0, and same with .modelZ, despite any translations, rotations, or scaling I make.

However, I’m still confused then why the coordinated of the vertices won’t change.

Does this help at all?

" i went back"
that is confusing??

model work after any transformation ( translate/rotate/shear )
but only ( if you save the readback ) before popMatrix
https://processing.org/reference/modelX_.html

did you try my code?

1 Like

Sorry for being confusing. I’ll try out your code and let you know what I find out. Thanks!

I believe I fixed the problem; thank you for your help!