Answers for "hingeJoint.angle equivalent for ConfigurableJoint?"
http://answers.unity.com/questions/32435/hingejointangle-equivalent-for-configurablejoint.html
The latest answers for the question "hingeJoint.angle equivalent for ConfigurableJoint?"Answer by inum76
http://answers.unity.com/answers/1077632/view.html
I found while using scrips, C#, The Rigidbody falls asleep. You need to wake it up within the script during each update.
This is my vid on the subject if you wish to check it out. [Link: ConfigurableJointScript 1][1]
Hope this helps.
[1]: https://www.youtube.com/watch?v=4X18N3g0mSkWed, 07 Oct 2015 01:16:59 GMTinum76Answer by UnitedBluff
http://answers.unity.com/answers/1005582/view.html
I came up with this and it seems to work. For some reason, in Jareikos function, secondary and third axes were switched, so my simple solution was simply to switch them again.
On a sidenote: why are these functions not build in ? How can anyone make gameplay without reading values ? Anyway here is the function. The values returned in the Vector3 are between -180 and 180.
public float to180(float v) {
if (v > 180) {
v = v - 360;
}
return v;
}
Vector3 jointRotation(ConfigurableJoint joint)
{
Quaternion jointBasis = Quaternion.LookRotation(joint.secondaryAxis, Vector3.Cross(joint.axis, joint.secondaryAxis));
Quaternion jointBasisInverse = Quaternion.Inverse(jointBasis);
var rotation = (jointBasisInverse * Quaternion.Inverse(joint.connectedBody.rotation) * joint.GetComponent<Rigidbody>().transform.rotation * jointBasis).eulerAngles;
return new Vector3(to180(rotation.x), to180(rotation.z),to180(rotation.y));
}Mon, 13 Jul 2015 10:02:16 GMTUnitedBluffAnswer by jareiko
http://answers.unity.com/answers/495104/view.html
This isn't quite right yet but I think I have the beginnings of a solution:
Quaternion jointRotation(ConfigurableJoint joint) {
Quaternion jointBasis = Quaternion.LookRotation(joint.secondaryAxis, Vector3.Cross(joint.axis, joint.secondaryAxis));
Quaternion jointBasisInverse = Quaternion.Inverse(jointBasis);
return jointBasisInverse * Quaternion.Inverse(joint.connectedBody.rotation) * joint.rigidbody.rotation * jointBasis;
}
You can then use the .eulerAngles property to get the angles. The X component corresponds to the primary joint axis. Hopefully, Y and Z will correspond to secondaryAxis and the implicit third axis, but I haven't checked that these are correct yet. If they're not correct, the jointBasis calculation may need to be tweaked.
Eg:
float angle = jointRotation(joint).eulerAngles.x;Wed, 17 Jul 2013 22:30:27 GMTjareikoAnswer by Jean-Fabre
http://answers.unity.com/answers/34508/view.html
<p>Hi,</p>
<p>Assuming you want to rotate around x axis:</p>
<p>-- select the connected rigid body</p>
<p>-- lock every axes BUT angular X motion ( Angular XMotion should be set to #free, the rest to #lock)</p>
<p>-- set the angular Xdrive mode to "velocity" </p>
<p>-- set the angular Xdrive position spring to 0 ( we don't need this for velocity drive)</p>
<p>-- set the angular Xdrive position damper to 10 ( varies depending on weight and volumes of RB)</p>
<p>-- set the angular Xdrive position force to 20 ( varies depending on weight and volumes of RB)</p>
<p>Generally I set the damper value to half of the the position force. that might be wrong, but that works so far.</p>
<p>then as the thing is playing, change the target velocity X value to 1, or 2, maybe more, the joint will turn, set back to 0 to stop rotating the joint.</p>
<p>A very important settings when you want to do accurate joints.</p>
<p>-- modify the anchor value to define where the pivot point reference is ( leave as is for no</p>
<p>for a complete rig using just configurable joint set up as hinges:</p>
<p><a href="http://forum.unity3d.com/threads/66871-Excavator-simulation" rel="nofollow">http://forum.unity3d.com/threads/66871-Excavator-simulation</a></p>
<p>Hope it helps,</p>
<p>Jean</p>Thu, 18 Nov 2010 12:00:15 GMTJean-Fabre