[ANSWERED] Inverse kinematics using 3D player and Calc Angle 3D actors
-
-
I don't know if that image represents revelation or a brain exploding. I guess I hope it's both. ;-)
Best WIshes,
Mark -
This is great Mark! thank you very much. I am not yet using Isadora v3, would you happen to have the you puppet file as a v2.6.1?
thank you
Don
-
@dritter said:
This is great Mark! thank you very much. I am not yet using Isadora v3, would you happen to have the you puppet file as a v2.6.1?
Dear Don,
No I don't. But here's the code for the JS Quaternion Calc Angles actor. Perhaps you can build it up from that.
include("three.min.js"); function radToDeg(f) { return f * 180.0 / Math.PI; } function main() { // IZ_INPUT 1 "x1" // IZ_INPUT 2 "y1" // IZ_INPUT 3 "z1" // IZ_INPUT 4 "x2" // IZ_INPUT 5 "y2" // IZ_INPUT 6 "z2" // IZ_OUTPUT 1 "rotation x" // IZ_OUTPUT 2 "rotation y" // IZ_OUTPUT 3 "rotation z" // IZ_OUTPUT 4 "translate x" // IZ_OUTPUT 5 "translate y" // IZ_OUTPUT 6 "translate z" // create v1 from the x1/y1/z1 arguments // this should be one point on a rigid body such as a hand var v1 = new THREE.Vector3(arguments[0], arguments[1], arguments[2]); // create v2 from the x2/y2/z2 arguments // this should be the second on the rigid body such as an elbow var v2 = new THREE.Vector3(arguments[3], arguments[4], arguments[5]);
v2.x = v2.x - v1.x; v2.y = v2.y - v1.y; v2.z = v2.z - v1.z; v1.x = 0; v1.y = -1; v1.z = 0; // vectors must be normalized for use with Quaternion v1.normalize(); v2.normalize(); // create a quaternion based on the two vectors var q = new THREE.Quaternion(); q.setFromUnitVectors(v1, v2); var e = new THREE.Euler(); e.setFromQuaternion(q, 'ZYX'); e.x = radToDeg(e.x); e.y = radToDeg(e.y); e.z = radToDeg(e.z); return [e.x, e.y, e.z, arguments[0], arguments[1], arguments[2]];
}
-
Great, thank you for spending time on this Mark. I just opened the patch in the demo version of Isadora 3, and it looks like I can rebuild this in 2.6.1. The .js code from your message above is displayed as black text on a grey background, but it becomes white text on a black background starting with the line "v2.x = v2.x -v1"; Is this important?
When I opened quaterion-puppet.izz in Isdora 3, I get the message that 001-one.3ds is missing, and I also get the messageThe following actors/plugins could not be loaded:
Skeleton Decoder (ID = '5F736B6C')
Unknown (ID = '5F736B6C')
Rokoko Studio Live Watcher (ID = '5F737370')
Should I be concerned about the first two items?many thanks,
Don
Don -
Wow! I really don’t know what to say - except to express gratitude for your care and effort!
It is a beautiful thing. The new tool is impressive, but I am astounded and humbled that you have taken so much care in presenting the theory and exemplar in your post. It should really become a knowledge base article, as the articulation back to some of the fundamental understandings of using 3D nodes in Isadora are so eloquently explained.
Best wishes
Russell
-
@dritter said:
The following actors/plugins could not be loaded: Skeleton Decoder (ID = '5F736B6C') Unknown (ID = '5F736B6C') Rokoko Studio Live Watcher (ID = '5F737370')Should I be concerned about the first two items?
No need for concern, those are non-public beta plugins that Mark used in his example, (which is why you don't have them).
-
@dritter said:
Should I be concerned
Hi Don,Considering the level of engagement you are working with using Isadora, it may be worthwhile considering making a request to join the beta testing group. As a beta tester you may be able to access additional resources associated with Isadora3 including the nodes in the download.
@woland, is it feasible to suggest inviting Don into the beta program?
Best wishes
Russell
-
@bonemap said:
is it feasible to suggest inviting Don into the beta program?
Can do!
@dritter
Please submit a new ticket using to link in my signature requesting to join the beta testing group and we can take it from there.
(There's no cost associated with joining and we'll provide you with a temporary Isadora 3 license to test with for a few months.) -
@bonemap said:
Wow! I really don’t know what to say - except to express gratitude for your care and effort!
It was a fun problem to solve. But, you're welcome. ;-)
-
OK, I have submitted a ticket to join the beta group. thank you.
-
Mark, this is very cool.
Three JS also includes physics and collision detection. It would be fun to take this further in this way. -
Happy New Year Mark and many thanks for the IK patch. I was able to reconstruct it for Isadora 2.6.1 and it is working fine with a Kinect and NI-mate. So far I have built IK for the lower arms(elbow-hand) and lower foot(knee-foot), but I have some questions about the following JS code within 'Macro JS Quaternion Calc angle':
// create v1 from the x1/y1/z1 arguments
// this should be one point on a rigid body such as a hand
var v1 = new THREE.Vector3(arguments[0], arguments[1], arguments[2]);
// print('v1 = ' + v1.x + ' ' + v1.y + ' ' + v1.z + '\n');
// create v2 from the x2/y2/z2 arguments
// this should be the second on the rigid body such as an elbow
var v2 = new THREE.Vector3(arguments[3], arguments[4], arguments[5]);QUESTION 1: Is it correct that v1 is the end-effector(or target), and v2 is the rotating joint? I am asking because the IK works for the arm link when v1 is the hand's xyz coordinates and v2 is the elbow's coordinates, but for the foot link, the IK works when v1 is the knee's xyz coordinates and v2 is the foot's xyz coordinates.
QUESTION 2: when the arm link is moved to vertical with the hand straight up, the link rotates 360 degrees around its Y axis(around the spine of the link). Is this normal, or perhaps I have made an error?
QUESTION 3: see below for the orientation of my link. When this link is used for the left or right arm, the IK works correctly when +180 is added to the x rotation provided by the JS Quaternion Calc actor, but this modification is not needed when the link is used for the lower leg. Does this seem normal, or perhaps I have made an error?
many, many thanks Mark,
Don