Rotate an array of 3ds objects

Started by claydergc, November 07, 2011, 08:26:51 PM

Previous topic - Next topic

claydergc

Hello,

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 :)

EgonOlsen

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 http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Config.html#useRotationPivotFrom3DS 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.