Report any bugs here and we'll post fixes
Moderators: Sascha Willems, Thomas
by pHySiQuE » Wed Sep 18, 2013 12:54 pm
If I call CustomLimitBallAndSocket::SetConeAngle() and CustomLimitBallAndSocket::SetTwistAngle() it appears the two parameters are actually swapped; the cone value is used for the twist behavior and the twist angle is used for the cone behavior.
Last edited by
pHySiQuE on Fri Oct 11, 2013 6:00 pm, edited 1 time in total.
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by pHySiQuE » Thu Oct 10, 2013 7:25 pm
Can you confirm this?
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by JoeJ » Fri Oct 11, 2013 4:27 am
There seems nothing wrong.
- Code: Select all
void CustomLimitBallAndSocket::SetConeAngle (dFloat angle)
{
m_coneAngleCos = dCos (angle);
m_coneAngleSin = dSin (angle);
m_coneAngleHalfCos = dCos (angle * 0.5f);
m_coneAngleHalfSin = dSin (angle * 0.5f);
}
void CustomLimitBallAndSocket::SetTwistAngle (dFloat minAngle, dFloat maxAngle)
{
m_minTwistAngle = minAngle;
m_maxTwistAngle = maxAngle;
}
- Code: Select all
const dVector& coneDir0 = matrix0.m_front;
const dVector& coneDir1 = matrix1.m_front;
dVector r0 (p0 + coneDir0.Scale(MIN_JOINT_PIN_LENGTH));
dVector r1 (p1 + coneDir1.Scale(MIN_JOINT_PIN_LENGTH));
// construct an orthogonal coordinate system with these two vectors
dVector lateralDir (coneDir0 * coneDir1);
dFloat mag2;
mag2 = lateralDir % lateralDir;
//...
{
dFloat cosAngle;
cosAngle = coneDir0 % coneDir1;
if (cosAngle < m_coneAngleCos) {
lateralDir = lateralDir.Scale (1.0f / dSqrt (mag2));
//...
I'd guess you're confused because your joint space does not have the orientation you assume.
Try rotating 90 degree steps. Note that the cone direction is the x or front axis, but you might think it should be y or z.
-
JoeJ
-
- Posts: 1453
- Joined: Tue Dec 21, 2010 6:18 pm
by Julio Jerez » Fri Oct 11, 2013 11:33 am
Tomorrow I will try to add a new demo show all of the joints.
I will then this is correct or not.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by pHySiQuE » Fri Oct 11, 2013 5:30 pm
When I create the pin and pivot matrix for CustomLimitBallAndSocket, it looks like this:
1, 0, 0, 0
0, 1, 0, 0
0, 0, 1, 0
x, y, z, 1
Is that correct or are you saying I should swap the x and z axes? (first and third rows)
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by pHySiQuE » Fri Oct 11, 2013 6:00 pm
I see now. I thought the ball joint automatically used the angle between the bodies as the pin direction. Once I supplied the pin direction myself, it worked as expected. Thank you.
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by JoeJ » Sat Oct 12, 2013 3:04 am
There are also cases where a single pin and pivot does not work at all.
F. ex. i construct a ragdoll from T-Pose. Initially legs are aligned straight downwards,
but the limit cone direction of the hip should point also forwards and outwards.
In such cases you can change the 2 local matrices manually after the joint creation.
-
JoeJ
-
- Posts: 1453
- Joined: Tue Dec 21, 2010 6:18 pm
by Julio Jerez » Sat Oct 12, 2013 7:43 am
this is why, we need to have the graphic editor for this things.
also that method I was saying before that can do a static analysis of an array of joint, can tell you if it will be stable or not.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by pHySiQuE » Sat Oct 12, 2013 4:54 pm
I think documentation and a more limited scope would do better. We only actually use three joint types now, and everyone is happier because they all work perfectly and are well-documented in our engine.
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
Return to Bugs and Fixes
Who is online
Users browsing this forum: No registered users and 2 guests