www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: AGP on January 09, 2014, 10:06:55 pm

Title: Vertices in Worldspace
Post by: AGP on January 09, 2014, 10:06:55 pm
Does the following method make sense? If not, how would I go about getting all vertices in worldspace?

Code: [Select]
     private SimpleVector wsVertices(Object3D obj) {
GenericVertexController vertexController = new GenericVertexController();
vertexController.init(obj.getMesh());
SimpleVector[] vertices = vertexController.getSourceMesh();
for (int i = 0; i < vertices.length; i++)
     vertices[i] *= obj.getTranslation(); //OR MAYBE obj.getTransformedCenter()?
return vertices;
     }
Title: Re: Vertices in Worldspace
Post by: EgonOlsen on January 09, 2014, 10:21:48 pm
Replace

Code: [Select]
vertices[i] *= obj.getTranslation();

with

Code: [Select]
vertices[i] *= obj.getWorldTransformation();

and it should work.
Title: Re: Vertices in Worldspace
Post by: AGP on January 09, 2014, 10:27:04 pm
Cool, thank you.