Jesper Rahlff Posted May 1, 2019 Share Posted May 1, 2019 Hi everyone. I have flower with of which I have isolated the stem and ran it through a simulation. I now want to reattach the head of the flower back to the stem but I obviously want the heads orientation to match with the new simulated stem. I have tried point deform but cannot get it to work. Although it does seems to be close its not matching up. attached is a hip with an isolated simple example of what I am trying to do. Any help is greatly appreciated. Thanks Attach_Flowerhead.hiplc Quote Link to comment Share on other sites More sharing options...
Noobini Posted May 2, 2019 Share Posted May 2, 2019 would Radius = 0 in pointdeform do ? Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted May 2, 2019 Author Share Posted May 2, 2019 (edited) 7 minutes ago, Noobini said: would Radius = 0 in pointdeform do ? unfortunately not. I know it works in the example file I provided, but with lots and lots of flowers and animation on the stems it wont work unfortunately. Edited May 2, 2019 by Jesper Rahlff Quote Link to comment Share on other sites More sharing options...
Andrea Posted May 2, 2019 Share Posted May 2, 2019 Hi! I love this kind of stuff I have attached an example. I had just 5 minutes to do it so I couldn't test it properly but it should work. The idea is to use the normal of the attachment point between the flower and the stem and transfer the rotation from the stem to the flower. Basically you use the dihedral function to find the difference between the rotation of the flower in the rest position and the rotation of the simulated stem (I have use a trasform node to move it around). After you found it you transfer this rotation to the transform matrix of the flower which is packed. I packed it just because is easier but I guess you can do it also without packing. When I have some time I can explain it better if you need to Attach_Flowerhead_fix00.hiplc Quote Link to comment Share on other sites More sharing options...
tamagochy Posted May 2, 2019 Share Posted May 2, 2019 Just take point from stem, if you use wire you have there orient attribute, if not calculate matrix, and apply matrix to flower head. If you dont need orient you can use just matrix vector4 orientr=quaternion(3@rot); //matrix for flawer head vector restP = point(1, "restP", point.number.from.stem); matrix m = set(qconvert(orientr)); translate(m, restP); p@restorient = orientr; vector4 orient = point(1, "orient", point.number.from.stem); orient = qmultiply(orient,orientr); vector pos = point(1, "P", point.number.from.stem); matrix t = set(qconvert(orient)); translate(t, pos); matrix r = invert(m)*t; @P *= r; @orient = orient; Quote Link to comment Share on other sites More sharing options...
Andrea Posted May 2, 2019 Share Posted May 2, 2019 That's really smart Andrii! I have a couple of questions if you don't mind: - So the translate function is for apply the rotation matrix to the flower geometry right? Basically is an offset based on the point position - Why the qmultiply? What is going to return the multiplication of two quaternions? Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted May 3, 2019 Author Share Posted May 3, 2019 Brilliant solutions both of them. Thank you for taking the time, this solved my problem right away. Time and time again the Odforce community just shows why it is the top of the league. Quote Link to comment Share on other sites More sharing options...
tamagochy Posted May 3, 2019 Share Posted May 3, 2019 23 hours ago, Andrea said: That's really smart Andrii! I have a couple of questions if you don't mind: - So the translate function is for apply the rotation matrix to the flower geometry right? Basically is an offset based on the point position - Why the qmultiply? What is going to return the multiplication of two quaternions? translate function just move matrix to the position qmultiply its the same as multiply matrix but for quaternions, its optional, you can skip this, I need to save initial orientation and use this one. 1 Quote Link to comment Share on other sites More sharing options...
Andrea Posted May 4, 2019 Share Posted May 4, 2019 On 3/5/2019 at 4:45 AM, Jesper Rahlff said: Brilliant solutions both of them. Thank you for taking the time, this solved my problem right away. Time and time again the Odforce community just shows why it is the top of the league. 16 hours ago, tamagochy said: translate function just move matrix to the position qmultiply its the same as multiply matrix but for quaternions, its optional, you can skip this, I need to save initial orientation and use this one. Understood, thank you! 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.