carlo_c Posted November 11, 2015 Share Posted November 11, 2015 (edited) Been at this for a bit now and am a bit stuck I've got 4 points conformed to a surface with ray. The object is parented to a Null and that is being animated with a curve and the path object parameter at object level. I have a wheel aligned to it using the Copy SOP. I have a working wheel rotation setup based off distance, but it doesn't want to work when it's copied onto the point. It is rotating, but in a strange way and I can't figure out why as it's working if I animate it inside it's geometry node with a transform. Any help is much appreciated, thanks all! car_rig_v05.hipnc Edited November 12, 2015 by carlo_c Quote Link to comment Share on other sites More sharing options...
Atom Posted November 12, 2015 Share Posted November 12, 2015 (edited) What about something like this. Instead of raying the wheel to the ground, I have rayed the curve to the ground. Using a measure sop I have added the length of the curve as an attribute named 'perimeter'. Then the wheel simply looks at the length of the path, the position along the path, it's own radius and calculates a rotation value which gets stamped into the X axis for rotation. The attribute wrangle makes the rotation that the copy will stamp with. float pi = 3.14159; // Fetch the curve length as a Pimitive attribute from the measure sop. string handle_path = "op:/obj/curve_length_measured/CURVE_OUT"; float curve_length = prim(handle_path,"perimeter",0); // Fetch position along path from NULL. float position_along_path = ch("../../null1/pos"); // The radius of the wheel as a constant, scale as needed or measure the model. float wheel_radius = 1.0; //Wheel rot value. @wheel_rot_X = 360 / (2*pi*wheel_radius) * (curve_length * position_along_path); ap_wheel_rotates_along_curve_landscape.hipnc Edited November 12, 2015 by Atom 1 Quote Link to comment Share on other sites More sharing options...
carlo_c Posted November 13, 2015 Author Share Posted November 13, 2015 (edited) Once again thanks for your help Atom, that's a much more elegant solution than what I was going with. I'm trying to build a simple car rig and this is really helpful! I was trying to do the wheel rotation independent of needing to know the curve length but I think for my purposes this is actually a much better solution Edited November 13, 2015 by carlo_c Quote Link to comment Share on other sites More sharing options...
michael Posted November 13, 2015 Share Posted November 13, 2015 just a little note here: PI is a built in variable see Edit > Aliases and Variables > Variables Quote Link to comment Share on other sites More sharing options...
carlo_c Posted November 18, 2015 Author Share Posted November 18, 2015 I have progressed with my very simple car rig but am at a bit of a road block again. I'm trying to align the car body to the wheels, it's hard to explain but if you take a look at the hip file I've annotated it all. basically the body needs to be aligned to the wheels but I just can't seem to get it to. Hopefully the screenshot explains it a bit too. As you can see it starts off aligned but then decides to do it's own thing, I have tried building my own orientation for it without much success! Any help would be much appreciated, thanks all car_rig_v09_odforce.hipnc Quote Link to comment Share on other sites More sharing options...
loopyllama Posted November 18, 2015 Share Posted November 18, 2015 Hi Carlos, The car *really* wanted to become a monster truck, so I obliged. It is really tempting to pull the prim normal from the oriented bounding box, but that is folly as the prim numbers change as the object rotates. You just need to calculate a solid N and Up for your copy SOP. Your existing N made a decent Up. To calculate N I created a point at the front and subtracted the point in the middle. This new N will always point forward. With this valid N and Up you no longer have to point the nose of the car towards the sky before the copy operation. car_rig_v09_odforce_monsterTruck.hipnc Quote Link to comment Share on other sites More sharing options...
carlo_c Posted November 19, 2015 Author Share Posted November 19, 2015 Haha that's awesome! Though I don't fully understand the part where you subtracted the position of the point in front it all works great. Thanks for your quick help! Quote Link to comment Share on other sites More sharing options...
loopyllama Posted November 19, 2015 Share Posted November 19, 2015 (edited) To get the direction of A to B, you take B and subtract A. I wanted to get the normal pointing "forward" in model space. I got a point in the middle/front of the box. I take the position of the middle/front point, subtract the position of the center point, and that gives me the vector from the center point to the middle/front point. I stuff vector that into the normal. The normal and up attributes assist the copy sop node orientation. Understanding (at least) vector math is critical to doing things in Houdini. Edited November 19, 2015 by loopyllama Quote Link to comment Share on other sites More sharing options...
carlo_c Posted November 20, 2015 Author Share Posted November 20, 2015 Thanks for the explanation, it's something I'm slowly wrapping my head around. The more I see it in use the better I'm understanding it! 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.