Author Topic: Rotate an array of 3ds objects  (Read 1335 times)

Offline claydergc

  • byte
  • *
  • Posts: 6
    • View Profile
Rotate an array of 3ds objects
« on: November 07, 2011, 08:26:51 pm »

I'm trying to load a 3ds object. As it is a big a one, it turns into an array of Object3D. When I want to rotate the whole 3D model around the X axis, I do it by using a for() statement, which rotates each element of the array; however, after rotating each element, the complete 3D model is shown disordered, for example: a 3D car is shown with tires on the car's roof, doors where tires should be, etc. I know the rotation is producing this problem, I also tried to rotate it around a differente axis, but I didn't find the correct axis to do it. Is there an easier way to solve my problem?

Thanks for your answer :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12035
    • View Profile
Re: Rotate an array of 3ds objects
« Reply #1 on: November 07, 2011, 08:35:11 pm »
That's because each sub-object has it's own rotation pivot based on the geometry or on the file information. With 3ds, you can define a rotation pivot in the file and make jPCT use it by setting to true before loading the file. Depending on the model, this might solve the problem. If not, you might to merge objects if possible and it that's not possible, you can create a dummy object, place it at the desired rotation pivot and make all parts of the model children of this dummy. Then simply rotate the dummy instead of all parts.