Drunkenpanda Posted April 19, 2023 Share Posted April 19, 2023 (edited) Hello, i have been trying to set the upvector to the normal of the plane formed by the joints the problem is that whatever i try it doesnt work in 1 of the joints. In essence it should just work if i take 3 joints of leg, make a polygon and then figure out a way toset the axis to the parent, one axis(up?) to the normal of that polygon and 1 axis to their cros product. (there is also one step where i try to set the pivot of a transform to the eulers of the lookat from axis to the normal so that i can scale it to pake sure the leg is on 1 plane if it hase more then 3 points) but whatever i try, everything is just off, Could anyone help me out ? In essence it should just work if i take 3 joints of leg, make a polygon and then figure out a way toset the axis to the parent, one axis(up?) to the normal of that polygon and 1 axis to their cros product. (there is also one step where i try to set the pivot of a transform to the eulers of the lookat from axis to the normal so that i can scale it to pake sure the leg is on 1 plane if it hase more then 3 points) but whatever i try, everything is just off, Could anyone help me out ? to do the scaling part i use this code. it works in some cases but ometimes the agle is 45 degree of in one axis. vector v1 = normalize({0, 1, 0}); // Define the first vector vector v2 = @up; // Define the second vector matrix3 m = lookat(v1, v2); // Create a matrix that rotates v1 to face v2 vector4 q = quaternion(m); // Convert the matrix to a quaternion vector v1 = normalize({0, 1, 0}); // Define the first vector printf("Rotation angles: (%g, %g, %g)\n", degrees(e.x), degrees(e.y), degrees(e.z)); vector v2 = @up; // Define the second vector matrix3 m = lookat(v1, v2); // Create a matrix that rotates v1 to face v2 Edited April 19, 2023 by Drunkenpanda 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.