tricecold Posted July 24, 2015 Share Posted July 24, 2015 Hi, I need to find a way to scale packed objects but with VEX. If I make a simple box, then pack it and use a transform to scale it it works as expected, but I need to accomplish this with VEX so if I copied 100 boxes on a grid and applied the code below all points move as expected, since point wrangle runs on points I get the same result without the loop also ( but thats another question) for( int i=0; i<1; i++ ){ @P.y += 1 + @Cd.r; } so I need to change the code above for scaling, any Ideas ??? Quote Link to comment Share on other sites More sharing options...
anim Posted July 24, 2015 Share Posted July 24, 2015 you need to modify intrinsic:transform of each primitive with intrinsic() and setintrinsic() VEX functions vector scale = fit01(vector(rand(@primnum)), 0.2,1); matrix3 trn = primintrinsic(0, "transform", @primnum); matrix scalem = maketransform(0, 0, {0,0,0}, {0,0,0}, scale, @P); trn *= matrix3(scalem); setprimintrinsic(0, "transform", @primnum, trn); attached file: ts_scale_packed_VEX.hip 2 2 Quote Link to comment Share on other sites More sharing options...
tricecold Posted July 24, 2015 Author Share Posted July 24, 2015 thanks a lot . That works perfect Quote Link to comment Share on other sites More sharing options...
tricecold Posted July 24, 2015 Author Share Posted July 24, 2015 I have another question , apparently I need to do the same treatment to the convex Hull shapes in DOPS ( a collegue told me to scale convex hull shape instead of recalculation, which is imho great idea for performance reasons). Even thou the collision visibility shows correct scale, pieces always collide with the startup collision size, unless I change sop object to deforming to update from outside the DOPS, which then works fine but I have to scale the packed objects outside. I would like to keep the scaling in DOPS, because I might connect the scaling to some random conditions that might or might not occur during the simulation ? Any idea Quote Link to comment Share on other sites More sharing options...
tricecold Posted August 30, 2015 Author Share Posted August 30, 2015 (edited) So here is an example file, of the above code working just fine, However the Convex Hull does not update, I am trying to scale the collision shape as well, instead of using use deforming active rigid objects. There has to be a way to scale the convex hull during simulation. Please Help PackedScale_RBDs.hipnc Edited August 30, 2015 by tricecold Quote Link to comment Share on other sites More sharing options...
pezetko Posted September 6, 2015 Share Posted September 6, 2015 Hi Tim, you can use ModifyData and link it to sopsolver. See attached example, rbd (dopimport's) input is not time dependent. Scaling happens inside sopsolver. I don't think that you can avoid using Active Deforming Object (I think it internally turns on some procedures that manage collision shape updates). (If somebody have better (more in depth) explanation I would like to know). pz_PackedScale_RBDs_in_DOPs.hipnc Quote Link to comment Share on other sites More sharing options...
sessionbeer Posted August 18, 2016 Share Posted August 18, 2016 vector scale = fit01(vector(rand(@primnum)), 0.2,1); matrix3 trn = primintrinsic(0, "transform", @primnum); matrix scalem = maketransform(0, 0, {0,0,0}, {0,0,0}, scale, @P); trn *= matrix3(scalem); setprimintrinsic(0, "transform", @primnum, trn); With @anim code, the scaling of the packed objects works great, but only if you want to scale up or down the original packed object by a given amount. I'm trying to replace the scale entirly with new values but due to trn *= matrix3(scalem); I'm multiplying my previous value by a value. Can someone explain how I replace the scale instead of multiplying it please? Quote Link to comment Share on other sites More sharing options...
rayman Posted September 12, 2016 Share Posted September 12, 2016 I gave this a try, as this was something I missed as a feature for a long time and found a really simple solution: just delete the id attribute when scaling to force bullet to update the collision geometry. Not sure if this is the most elegant solution but it looks that it works fine even with sims with constraints. i@id=-1 also works, so you can update it faster using Geometry wrangle instead of SOP solver + wrangle nodes. float sc = 1.01; vector scale = set(sc,sc,sc); matrix3 trn = primintrinsic(0, "transform", @primnum); matrix scalem = maketransform(0, 0, {0,0,0}, {0,0,0}, scale, @P); trn *= matrix3(scalem); setprimintrinsic(0, "transform", @primnum, trn); int pts[] = primpoints(0,i@primnum); setpointattrib(0,"id",pts[0],-1); Cheers! 5 Quote Link to comment Share on other sites More sharing options...
tricecold Posted September 12, 2016 Author Share Posted September 12, 2016 Jeff Wagner said that's the only way at the moment Quote Link to comment Share on other sites More sharing options...
rayman Posted September 12, 2016 Share Posted September 12, 2016 4 minutes ago, tricecold said: Jeff Wagner said that's the only way at the moment Thanks, man! Good to know! Quote Link to comment Share on other sites More sharing options...
MagnusL3D Posted January 10, 2017 Share Posted January 10, 2017 Pavel, would it be possible to post an example file because I feel like I am missing something in your explenation ? Quote Link to comment Share on other sites More sharing options...
mestela Posted February 9, 2018 Share Posted February 9, 2018 I have an example here: http://www.tokeru.com/cgwiki/index.php?title=HoudiniDops#RBD_deintersect_via_scaling_up_geo 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.