Jump to content

follow path how to get actual transform of the object


ino

Recommended Posts

50 minutes ago, ino said:

although the object is moving along the path its position isnt changing in the spreadsheet 

what spreadsheet? parameter spreadsheet?

the parameters on each Object represent it's local transform, which is applied on top of it's Parent Transform, Subnet Trandform and Pre-Transform, additionally Constraints can query any of those transforms or combination and produce final world space transform 

you can query it using Object CHOP, optransform() VEX function, node.worldTransform() Python Function, origin() Hscript function among others

you can also objectmerge geo of such object into SOPs and if you Pack Before Merging, the merged geo will have packedfulltransform intrinsic containing the world transform of that object

...

  • Haha 1
Link to comment
Share on other sites

thanks 

you obviously know what you are talking about 

yes its the parameter spreadsheet i meant 

i would need the transformed position in a wrangler to set color depending on position

 

 

in the meantime i figured i can use

right click / reference / scene data / my object / transformation ...

and i get this 

if i copy this straight in to a wrangler i get a bunch of errors not a big thing that i could probably fix

in the end this is fine and will work 

BUT is there really now easier way

something like 

x = getmetransform("object", "position", "X");

z = getmetransform("object", "rotation", "Z");

and not 10 lines of code where i need to add each and every transformation of the object one by one by hand 

 

 

{

matrix src_input_xform_inverted = invert(optransform(opinput("../../pen", 0)));
matrix src_xform = optransform("../../pen");
matrix src_local_xform = src_xform * src_input_xform_inverted;
matrix target_xform_inverted = invert(optransform(opcreator(".")));
matrix final_xform = src_local_xform * target_xform_inverted;


matrix rest_xform = identity(4);
matrix self_xform = rest_xform * final_xform;

float result = explodematrixpr(
        self_xform, 
        vector3(ch("./px"), ch("./py"), ch("./pz")),
        vector3(ch("./prx"), ch("./pry"), ch("./prz")),
        chs("./xOrd"), chs("./rOrd"), "TX");
return result;

}

 

Link to comment
Share on other sites

5 hours ago, ino said:

BUT is there really now easier way

something like 

x = getmetransform("object", "position", "X");

now I'm not sure if you read through my post at all, but as I mentioned you can use origin() Hscript expression

origin("", "../path/to/object", "TX")

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...