Author Topic: Vertices in Worldspace  (Read 2038 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Vertices in Worldspace
« 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;
     }

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Vertices in Worldspace
« Reply #1 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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Vertices in Worldspace
« Reply #2 on: January 09, 2014, 10:27:04 pm »
Cool, thank you.