Better API naming. Enable self-collision by default.
This commit is contained in:
@ -45,9 +45,9 @@ bool b3ClothDragger::StartDragging()
|
||||
m_triangle = m_mesh->triangles + rayOut.triangle;
|
||||
m_x = rayOut.fraction;
|
||||
|
||||
b3Particle* p1 = m_cloth->GetVertexParticle(m_triangle->v1);
|
||||
b3Particle* p2 = m_cloth->GetVertexParticle(m_triangle->v2);
|
||||
b3Particle* p3 = m_cloth->GetVertexParticle(m_triangle->v3);
|
||||
b3Particle* p1 = m_cloth->GetParticle(m_triangle->v1);
|
||||
b3Particle* p2 = m_cloth->GetParticle(m_triangle->v2);
|
||||
b3Particle* p3 = m_cloth->GetParticle(m_triangle->v3);
|
||||
|
||||
b3Vec3 v1 = p1->GetPosition();
|
||||
b3Vec3 v2 = p2->GetPosition();
|
||||
@ -133,13 +133,13 @@ void b3ClothDragger::Drag()
|
||||
}
|
||||
else
|
||||
{
|
||||
b3Particle* p1 = m_cloth->GetVertexParticle(m_triangle->v1);
|
||||
b3Particle* p1 = m_cloth->GetParticle(m_triangle->v1);
|
||||
p1->ApplyTranslation(dx);
|
||||
|
||||
b3Particle* p2 = m_cloth->GetVertexParticle(m_triangle->v2);
|
||||
b3Particle* p2 = m_cloth->GetParticle(m_triangle->v2);
|
||||
p2->ApplyTranslation(dx);
|
||||
|
||||
b3Particle* p3 = m_cloth->GetVertexParticle(m_triangle->v3);
|
||||
b3Particle* p3 = m_cloth->GetParticle(m_triangle->v3);
|
||||
p3->ApplyTranslation(dx);
|
||||
}
|
||||
}
|
||||
@ -172,9 +172,9 @@ void b3ClothDragger::StopDragging()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cloth->GetVertexParticle(m_triangle->v1)->SetType(m_t1);
|
||||
m_cloth->GetVertexParticle(m_triangle->v2)->SetType(m_t2);
|
||||
m_cloth->GetVertexParticle(m_triangle->v3)->SetType(m_t3);
|
||||
m_cloth->GetParticle(m_triangle->v1)->SetType(m_t1);
|
||||
m_cloth->GetParticle(m_triangle->v2)->SetType(m_t2);
|
||||
m_cloth->GetParticle(m_triangle->v3)->SetType(m_t3);
|
||||
}
|
||||
|
||||
m_triangle = nullptr;
|
||||
@ -184,9 +184,9 @@ b3Vec3 b3ClothDragger::GetPointA() const
|
||||
{
|
||||
B3_ASSERT(IsDragging() == true);
|
||||
|
||||
b3Vec3 A = m_cloth->GetVertexParticle(m_triangle->v1)->GetPosition();
|
||||
b3Vec3 B = m_cloth->GetVertexParticle(m_triangle->v2)->GetPosition();
|
||||
b3Vec3 C = m_cloth->GetVertexParticle(m_triangle->v3)->GetPosition();
|
||||
b3Vec3 A = m_cloth->GetParticle(m_triangle->v1)->GetPosition();
|
||||
b3Vec3 B = m_cloth->GetParticle(m_triangle->v2)->GetPosition();
|
||||
b3Vec3 C = m_cloth->GetParticle(m_triangle->v3)->GetPosition();
|
||||
|
||||
return m_u * A + m_v * B + (1.0f - m_u - m_v) * C;
|
||||
}
|
||||
|
@ -130,8 +130,15 @@ public:
|
||||
u32 v1 = s->GetParticle1()->GetVertex();
|
||||
u32 v2 = s->GetParticle2()->GetVertex();
|
||||
|
||||
tension[v1] += s->GetActionForce();
|
||||
tension[v2] -= s->GetActionForce();
|
||||
if (v1 != ~0)
|
||||
{
|
||||
tension[v1] += s->GetActionForce();
|
||||
}
|
||||
|
||||
if (v2 != ~0)
|
||||
{
|
||||
tension[v2] -= s->GetActionForce();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,13 +146,13 @@ public:
|
||||
{
|
||||
b3ClothMeshTriangle* t = mesh->triangles + i;
|
||||
|
||||
b3Vec3 v1 = m_cloth->GetVertexParticle(t->v1)->GetPosition();
|
||||
b3Vec3 v2 = m_cloth->GetVertexParticle(t->v2)->GetPosition();
|
||||
b3Vec3 v3 = m_cloth->GetVertexParticle(t->v3)->GetPosition();
|
||||
b3Vec3 v1 = m_cloth->GetParticle(t->v1)->GetPosition();
|
||||
b3Vec3 v2 = m_cloth->GetParticle(t->v2)->GetPosition();
|
||||
b3Vec3 v3 = m_cloth->GetParticle(t->v3)->GetPosition();
|
||||
|
||||
b3Draw_draw->DrawSegment(v1, v2, b3Color_black);
|
||||
b3Draw_draw->DrawSegment(v2, v3, b3Color_black);
|
||||
b3Draw_draw->DrawSegment(v3, v1, b3Color_black);
|
||||
g_draw->DrawSegment(v1, v2, b3Color_black);
|
||||
g_draw->DrawSegment(v2, v3, b3Color_black);
|
||||
g_draw->DrawSegment(v3, v1, b3Color_black);
|
||||
|
||||
b3Vec3 f1 = tension[t->v1];
|
||||
float32 L1 = b3Length(f1);
|
||||
|
Reference in New Issue
Block a user