Moh Mah
Moh Mah

Reputation: 2055

Changing Pivot Point in Java3D

I've imported some 3d models in java3D and I want to change the pivot point of my model from the origin to a specific point! Please don't say to translate to origin, rotate and then translate back I want to know the exact way .

Upvotes: 1

Views: 856

Answers (2)

Mihai Bujanca
Mihai Bujanca

Reputation: 4209

This helped me. The idea of translation is good, actually, do it like follows: Create a TransformGroup "tg" for example containing the node you would like to rotate and/or translate. Be sure that you translate it to the point you want to be your pivot point. Then, create a new TransformGroup containing tg, and rotate it. Translate back then (translate with the same vector*(-1)). Rotation around a specific point (eg, rotate around 0,0,0) This helped me

Upvotes: 2

Andy
Andy

Reputation: 8640

If I understand what you mean, you should traverse the scene graph produced by the model loader, find any GeometryArrays in it, and translate all the coordinates in the GeometryArrays (this is no simple task -- coordinates can be stored in a number of ways). That way a simple rotation transform would rotate around a different pivot point than before.

Upvotes: 0

Related Questions