tra\nslation and rotation problem

All

I have an obj read in positioned say at 10,10,10. When I rotate it around an axis it make a big loop around the actual scene axis instead of rotating arounds its own origin. What the best way to make it rotate arounds it (local coordinates??) Do I need to manually translate to 0,0,0, rotate, reposition back to 10,10,10 each time I rotate??

the age old question :slight_smile:

It is important that your geometry is loaded with 0 as your reference point. If your geometry is sitting at 10,10,10, then you are sunk (go back, correctly position the geometry and re-export the file).

The best way to achieve this is to have a chain of transform groups, like so:

Translate to (10,10,10) --> Rotate 90 degrees --> Object

That way, the object is rotated, then translated.

If you reverse the two TG’s, then it is translated and then rotated.

If your geometry is at (10,10,10) when you exported, then trying to translate it (-10,-10,-10) won’t actually work because that translation moves the relitive origin as well. You have to manually translate the geometry vertex data array while loading (this is what I do with the ASE loader, fortunately the code is in the loader so it is now all automated).

I cover this in depth in the Transform Group Trees with the ASE loader tutorial in the GSG. The advantage of the ASE loader is that I made it so that the tree is automatically built, and the geometry is offset by its pivot point and transformed into position.

Cheers,

Will.