Hey guys,
This seems like a situation that should have come up before, but for some reason I am unable to find a simple solution…
I have a plane I am using for a wall, I have my bones all weighted and in position, I can manually move them into position…
Now why can’t I figure out how to make their y property point away from a Vector3?
say I have 2 bones, called bones, they are vertical at 0,0 and 0,1. they are 1 unit tall. They contain a weighted mesh between them. I want to be able to make them warp that mesh based on a point at (.5f,-10f,.5f) using the bones’ down vector.
I have been reading Quaternions and Eulers for 6 hours now /wrist. help! Here is a code smippet I have been playing with based on some tutorials…
(I am aware I should be looping and that my code is inefficient, it is torn down for debugging)
Vector3 DUMMYCENTER = new Vector3(.5f,-3f,.5f);
Vector3[] Q2EAnglers = new Vector3[8];
Q2EAnglers[0] = Quaternion.LookRotation(DUMMYCENTER - DSWBones[0].position).eulerAngles;
//Q2EAnglers[0].x = 0;//
Q2EAnglers[0].y = 0;//
Q2EAnglers[0].z = 0;//
Q2EAnglers[1] = Quaternion.LookRotation(DUMMYCENTER - DWWBones[0].position).eulerAngles;
Q2EAnglers[1].x = 0;//
Q2EAnglers[1].y = 0;//
//Q2EAnglers[1].z = 0;//
Q2EAnglers[2] = Quaternion.LookRotation(DUMMYCENTER - DEWBones[0].position).eulerAngles;
Q2EAnglers[2].x = 0;
Q2EAnglers[2].y = 0;
//Q2EAnglers[2].z = 0;//
Q2EAnglers[3] = Quaternion.LookRotation(DUMMYCENTER - DNWBones[0].position).eulerAngles;
Q2EAnglers[3].x = 0;
Q2EAnglers[3].y = 0;
//Q2EAnglers[3].z = 0;//
Q2EAnglers[4] = Quaternion.LookRotation(DUMMYCENTER - DSWBones[1].position).eulerAngles;
//Q2EAnglers[4].x = 0;//
Q2EAnglers[4].y = 0;//
Q2EAnglers[4].z = 0;//
Q2EAnglers[5] = Quaternion.LookRotation(DUMMYCENTER - DWWBones[1].position).eulerAngles;
Q2EAnglers[5].x = 0;
Q2EAnglers[5].y = 0;
//Q2EAnglers[5].z = 0;//
Q2EAnglers[6] = Quaternion.LookRotation(DUMMYCENTER - DEWBones[1].position).eulerAngles;
Q2EAnglers[6].x = 0;
Q2EAnglers[6].y = 0;
//Q2EAnglers[6].z = 0;//
Q2EAnglers[7] = Quaternion.LookRotation(DUMMYCENTER - DNWBones[1].position).eulerAngles;
Q2EAnglers[7].x = 0;
//Q2EAnglers[7].y = 0;
Q2EAnglers[7].z = 0;//
DSWBones[0].rotation = Quaternion.Euler(Q2EAnglers[0]);
DWWBones[0].rotation = Quaternion.Euler(Q2EAnglers[1]);
DEWBones[0].rotation = Quaternion.Euler(Q2EAnglers[2]);
DNWBones[0].rotation = Quaternion.Euler(Q2EAnglers[3]);
DSWBones[1].rotation = Quaternion.Euler(Q2EAnglers[4]);
DWWBones[1].rotation = Quaternion.Euler(Q2EAnglers[5]);
DEWBones[1].rotation = Quaternion.Euler(Q2EAnglers[6]);
DNWBones[1].rotation = Quaternion.Euler(Q2EAnglers[7]);
Maybe there is a way to extend Transform? Maybe overload the Lookat() Method?
– Cyber_Defectcmon, there has to be a solution for this...
– Cyber_Defect