rename a function, update a test

This commit is contained in:
Irlan
2018-10-05 11:57:23 -03:00
parent 8030c3458a
commit 6b95a04a09
3 changed files with 31 additions and 30 deletions

View File

@ -6,18 +6,18 @@ class ShapeCast : public Test
public:
ShapeCast()
{
m_xfA.SetIdentity();
m_shapeA.m_hull = &b3BoxHull_identity;
m_shapeA.m_radius = 0.0f;
m_shapeB.m_hull = &b3BoxHull_identity;
m_shapeB.m_radius = 0.0f;
m_xfA.position.Set(-5.0f, 0.0f, 0.0f);
m_xfA.rotation.SetIdentity();
m_shapeA.m_centers[0].Set(0.0f, -2.0f, 0.0f);
m_shapeA.m_centers[1].Set(0.0f, 2.0f, 0.0f);
m_shapeA.m_radius = 1.0f;
m_xfB.SetIdentity();
m_xfB.position.Set(5.0f, 0.0f, 0.0f);
m_xfB.position.Set(10.0f, 0.0f, 0.0f);
m_xfB.rotation.SetIdentity();
m_shapeB.m_hull = &b3BoxHull_identity;
m_proxyA.Set(&m_shapeA, 0);
m_proxyB.Set(&m_shapeB, 0);
}
@ -33,18 +33,21 @@ public:
m_world.DrawShape(m_xfA, &m_shapeA);
m_world.DrawShape(m_xfB, &m_shapeB);
b3Vec3 translationB = -20.0f * b3Vec3_x;
g_draw->DrawSolidShape(&m_shapeA, b3Color_white, m_xfA);
g_draw->DrawSolidShape(&m_shapeB, b3Color_white, m_xfB);
b3Vec3 translationB = -100.0f * b3Vec3_x;
g_draw->DrawSegment(m_xfB.position, m_xfB.position + translationB, b3Color_white);
b3GJKRayCastOutput out;
bool hit = b3GJKRayCast(&out, m_xfA, m_proxyA, m_xfB, m_proxyB, translationB);
b3GJKShapeCastOutput out;
bool hit = b3GJKShapeCast(&out, m_xfA, m_proxyA, m_xfB, m_proxyB, translationB);
g_draw->DrawString(b3Color_white, "Iterations = %d", out.iterations);
if (hit)
{
g_draw->DrawPoint(out.point, 4.0f, b3Color(0.0f, 1.0f, 0.0f));
g_draw->DrawSegment(out.point, out.point + out.normal, b3Color(0.0f, 1.0f, 0.0f));
g_draw->DrawPoint(out.point, 4.0f, b3Color_green);
g_draw->DrawSegment(out.point, out.point + out.normal, b3Color_green);
b3Transform xfB;
xfB.rotation = m_xfB.rotation;
@ -106,7 +109,7 @@ public:
return new ShapeCast();
}
b3CapsuleShape m_shapeA;
b3HullShape m_shapeA;
b3Transform m_xfA;
b3ShapeGJKProxy m_proxyA;