magneto Posted March 3, 2012 Share Posted March 3, 2012 I am trying to use the dot expression which requires 2 vector values. I want to use the position of 2 different objects. I can access tx, ty, tx, but not t. What's the right way to do this? Because I know ch expression references basic component values, like x, y, z, r, g, b but not the compound data itself. Thanks Quote Link to comment Share on other sites More sharing options...
symek Posted March 3, 2012 Share Posted March 3, 2012 (edited) In hscript that would be something along the line: dot(vtorigin("/obj/geo1", ""), vtorigin("/obj/geo2","")) note it takes parenting into account thanks to vtorigin(), which computes actual world position, not just t?. Python though predictably is more verbatim: t1 = hou.node("/obj/geo1").worldTransform().extractTranslates() t2 = hou.node("/obj/geo2").worldTransform().extractTranslates() t1.dot(t2) Edited March 3, 2012 by SYmek 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted March 3, 2012 Author Share Posted March 3, 2012 Thanks Symek, owe you again Btw also thought this when looking at the available expressions: There is a vector3 expression. Can you use this to create a vector3 from 3 channel references (tx, ty, tz) for each object and then use it? I.e.: dot(vector3(x1,y1,z1), vector3(x2,y2,z2)) I imagine this wouldn't take parenting into account like your vtorigin example? Quote Link to comment Share on other sites More sharing options...
symek Posted March 3, 2012 Share Posted March 3, 2012 (edited) There is a vector3 expression. Can you use this to create a vector3 from 3 channel references (tx, ty, tz) for each object and then use it? I.e.: dot(vector3(x1,y1,z1), vector3(x2,y2,z2)) I imagine this wouldn't take parenting into account like your vtorigin example? Sure you can, but as you say, this takes solely channel values, which is often not perfect, since your objects can live in subnets, or be parented. exhelp -k keyword is your friend and great evening companion /-> exhelp -k vector angvel dopfieldtype matrix stripmatrix volumegradient clamptosphere dopoptions mlookat vangle vorigin cross dot mlookatup vector vrorigin dihedral explodematrix mobjlookat vector3 vscale distance explodematrixp normalize vector4 vset dopallfields iprquery objlookat vlength vsize dopfield length rotaxis vlength2 vtorigin dopfields Edited March 3, 2012 by SYmek 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted March 3, 2012 Author Share Posted March 3, 2012 Thanks Symek, you are my companion though I will use exhelp. I didn't know it provided more options like that. Lastly in your first reply, you also showed the Python version. Do you use python expressions yourself? I see most people's examples have hscript and thought maybe it's because it's shorter and most people are used to it more. Reason I ask this is because, I don't wanna use say all python expressions and alienate the majority who use hscript when sharing scenes, etc Quote Link to comment Share on other sites More sharing options...
symek Posted March 3, 2012 Share Posted March 3, 2012 (edited) Lastly in your first reply, you also showed the Python version. Do you use python expressions yourself? I see most people's examples have hscript and thought maybe it's because it's shorter and most people are used to it more. It depends on complexity. I would compute a dot() with hscript, but say cancelling rotation in matrix is Python thing. As long as you don't feel like you're fighting with the code, hscript is fine . I specially like custom expression functions read with exread from disk, tasty! edit: surely I meant exread Edited March 3, 2012 by SYmek 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted March 3, 2012 Author Share Posted March 3, 2012 Thanks for clearing that out. I never used mread, but is exread not better to read a custom expression from disk? A quick look at mread, I saw it's for loading a hip file, but not really sure. If you are doing it though, there must be a reason Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.