Determ

08-07-2006, 11:53 AM

Hello,

I'm trying to create a non twisting IK arm/leg chain. I want an IK arm which only bends but doesn't twist - the mesh should not collapse because of twisting (like it is happening at the shoulder of an IK arm). This makes the rotations very complicated for me. I've done some R&D and came up with scripted controllers for upper arm and lower arm rotations (specifically for X rotations). I found their x rotations depending on the shoulder x,y,z rotations and their own y,z rotations. I found out how they depend on all those rotations except the shoulder y rotation. This really gives me some headache now. I searched the forum and Google for a possible solution, but didn't find anything dealing with it although I think this must have been solved somewhere already. Here is the code for the upper arm sripted rotation controller:

--get upper arm bone own rotations

A01y = A01.rotation.y_rotation

A01ys = A01y/abs(A01y)

A01z = A01.rotation.z_rotation

--get shoulder rotations

Shx = Sh.rotation.x_rotation

--Shy = Sh.rotation.y_rotation

--Shys = Shy/abs(Shy)

Shz = Sh.rotation.z_rotation

--difference of shoulder and upper arm bone z rotations

Rz = A01z-Shz

--"limit" the difference of z rotations to -180..180 degrees

REZ = ((eulerAngles 0 0 Rz) as quat) as eulerAngles

REzs = REZ.z/abs(REZ.z)

--main part of the upper arm x rotation

X = 180 * REzs * A01ys * (abs(REZ.z)/180)^(90/abs(A01y)/)

--build upper arm rotation

eulerAngles (X+Shx) A01y A01z

With this you can rotate the upper arm in any direction and the shoulder around x and z without the mesh collapsing. Unfortunately I don't know how the shoulder y rotation influences X in the script (formula). I believe it might well be possible that there is a much more elegant solution to that problem than my approach, but I don't know 3ds Max all that well. Many thank's for help.

I'm trying to create a non twisting IK arm/leg chain. I want an IK arm which only bends but doesn't twist - the mesh should not collapse because of twisting (like it is happening at the shoulder of an IK arm). This makes the rotations very complicated for me. I've done some R&D and came up with scripted controllers for upper arm and lower arm rotations (specifically for X rotations). I found their x rotations depending on the shoulder x,y,z rotations and their own y,z rotations. I found out how they depend on all those rotations except the shoulder y rotation. This really gives me some headache now. I searched the forum and Google for a possible solution, but didn't find anything dealing with it although I think this must have been solved somewhere already. Here is the code for the upper arm sripted rotation controller:

--get upper arm bone own rotations

A01y = A01.rotation.y_rotation

A01ys = A01y/abs(A01y)

A01z = A01.rotation.z_rotation

--get shoulder rotations

Shx = Sh.rotation.x_rotation

--Shy = Sh.rotation.y_rotation

--Shys = Shy/abs(Shy)

Shz = Sh.rotation.z_rotation

--difference of shoulder and upper arm bone z rotations

Rz = A01z-Shz

--"limit" the difference of z rotations to -180..180 degrees

REZ = ((eulerAngles 0 0 Rz) as quat) as eulerAngles

REzs = REZ.z/abs(REZ.z)

--main part of the upper arm x rotation

X = 180 * REzs * A01ys * (abs(REZ.z)/180)^(90/abs(A01y)/)

--build upper arm rotation

eulerAngles (X+Shx) A01y A01z

With this you can rotate the upper arm in any direction and the shoulder around x and z without the mesh collapsing. Unfortunately I don't know how the shoulder y rotation influences X in the script (formula). I believe it might well be possible that there is a much more elegant solution to that problem than my approach, but I don't know 3ds Max all that well. Many thank's for help.