Determine the origin of a component in world space
-
This is probably a dumb question, but hopefully someone can shed some light on this for me.
I'm basically exporting geometry out of Sketchup for use as game models. The exporter I use (an rbs) exports the origin of the component as the origin of the model. So far so good.
Well some of my models are quite large and need to be split into quads for performance (and visibility). Once they are exported, I need to translate them back to where they were in the sketchup file in the game editor (Hammer). So I start the model entity at 0,0,0 and translate by the Sketchup component's coordinates (or what I think they are).
This almost all works. The problem I'm having is that while they all align perfectly in the X,Y dimension, the Z is always off between models (ie components). Sometimes very little, sometimes more than 1 unit, which I think rules out a rounding error.
I've tried various things, adding a common "bottom" element to each quad model, and moving the axis to the bottom center via axiscomp.rb plugin, but still off.
So I'm flummoxed at this point, I'm probably not understanding something about insertion points (or maybe it's something in the game tools) but if anyone can tell me the proper way to retrieve this information, I'd appreciate it.
-
Every group or component-instance has a complex transformation giving 3d location, rotation, scaling and so on...
You can use that
insertion_point = instance.transformation.origin
-
@tig said:
Every group or component-instance has a complex transformation giving 3d location, rotation, scaling and so on...
You can use that
insertion_point = instance.transformation.origin
I had a feeling you'd be the one to answer TIG, and Thank you, thank you, thank you. Works perfectly. I spent hours pulling hair on this. Don't know why I didn't think of that.
Advertisement