Author Topic: multi object in one sigle file.  (Read 2335 times)

Offline tinhtinhcd

  • byte
  • *
  • Posts: 16
    • View Profile
multi object in one sigle file.
« on: August 04, 2017, 12:56:41 pm »
Hi,

I have an obj file with many object inside (about 67 object).
currently, when load from obj i made the fist object as parent and add the other as child to rotate and zoom.
the problem is when i set parent as center camera and rotate, it will rotate around the parent object, not the middle of them.
how can I rotate around the middle of them because I don't know which object is in the center of all object.


Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: multi object in one sigle file.
« Reply #1 on: August 05, 2017, 03:31:19 am »
you can call setCenter or setRotationPivot on an Object3D

Offline tinhtinhcd

  • byte
  • *
  • Posts: 16
    • View Profile
Re: multi object in one sigle file.
« Reply #2 on: August 07, 2017, 04:55:51 am »
but the are many object, which object should i call.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: multi object in one sigle file.
« Reply #3 on: August 07, 2017, 10:57:50 am »
Usually on the object that rotates. However, in your case, it might be a better solution to create a dummy object and place that at the desired rotation pivot. Then make all other objects children of that dummy object and rotate only that.

Offline tinhtinhcd

  • byte
  • *
  • Posts: 16
    • View Profile
Re: multi object in one sigle file.
« Reply #4 on: August 08, 2017, 06:50:37 am »
Thanks EgonOlsen,

 yesterday i saw the method megerAll(), i call this and treat all as one object, i see it work fine for me now.