[Closed] What's the correct way of geting objects coordinates?
Hi guys !
I’m writing a script, that exports Max model’s into custom scene format and i’m having a HUGE problem with models coordinates. Models that are created in max are exporting fine (well…most of the times), but models linked or imported from another app don’t always work. They are acting quite randomly when i import my custom scene into the program i use. I cant find any common pattern of when they don’t work and when they do. Sometimes even resetxform doesnt help, but messes up things even more.
I obviously need some help from you guys !
What is the correct way of geting the object position out of max? is it pos or transform or objecttransform or inversed versions of those… or any other way? (i think i’ve tested all of those)
Why models imported into max from another app are acting differently? How can i “reset” them correctly? I’ve tried millions of things, but nothing seems to work 100%. What works in one scene doesnt always work in other and vice versa.
I feel like I’m going crazy…(maby i am already)
I’ll give a six-pack to someone who helps me out (well… if he/she lives near enough:) )
Thank you in advance!
Suvakas
For import and export Im’ always use OBJ format and its’ working good.
I mean no big changes in geometry
Actually i’m already using OBJ. The geometry is fine. What is wrong is the position.
The scene format i export into defines a model like this:
model = blah.obj
pos = 10,20,0
The pos part is the one that i’m having troubles with. 10-20% of the times i dont get the correct position out of max. It mostly happens with imported or linked models, but sometimes also with models made in max.
I’m exporting the OBJ via maxscript and taking the pos from transform.row4
And it does NOT work as i assume. Strange, that a simple thing like this and i cant get it to work.
Suvakas
So geting the right position is not an easy question?
I would be happy even with some small tip or direction from where to look at.
I think my main problem is why imported objects are acting differently…
Suvakas
[edit] Eh…I replied same time as you
Can you explain a bit what do you mean?
if u teake $.pos , thats mean: pivot position in max world space
but… the pivot can be moved inside on an obj ,for that reason u need remember his position
to.
$.pos
$.min
$.max
Well…ok…
I think i still need some help here
pos gives me the pivot right? and min and max are giving me the bounding box of a model.
But whats next (sry if it’s stupid question) ?
How can i implement this into correct position value?
Suvakas
the min and max give you true position of object in a max scene
what is the next?
before u export a model teake this:
obj_pos = ($.min + $.max)/2
pivot_pos = $.pos
after import do this:
$.pivot = obj_pos
$.pos = pivot_pos
chers;)
Thank you !!
I never thought about using min and max like that. Interesting.
I’ll test this approach. Thanks.
Suvakas