centralize automatically generated cylinder and cone hulls
This commit is contained in:
parent
4b5df1dfc2
commit
aebe39143d
@ -424,7 +424,7 @@ void b3QHull::SetAsCylinder(float32 radius, float32 height)
|
|||||||
b3Quat q = b3QuatRotationY(kAngleInc);
|
b3Quat q = b3QuatRotationY(kAngleInc);
|
||||||
|
|
||||||
{
|
{
|
||||||
b3Vec3 center(0.0f, 0.0f, 0.0f);
|
b3Vec3 center(0.0f, -0.5f * height, 0.0f);
|
||||||
b3Vec3 n1(1.0f, 0.0f, 0.0f);
|
b3Vec3 n1(1.0f, 0.0f, 0.0f);
|
||||||
b3Vec3 v1 = center + radius * n1;
|
b3Vec3 v1 = center + radius * n1;
|
||||||
for (u32 i = 0; i < kEdgeCount; ++i)
|
for (u32 i = 0; i < kEdgeCount; ++i)
|
||||||
@ -441,7 +441,7 @@ void b3QHull::SetAsCylinder(float32 radius, float32 height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
b3Vec3 center(0.0f, height, 0.0f);
|
b3Vec3 center(0.0f, 0.5f * height, 0.0f);
|
||||||
b3Vec3 n1(1.0f, 0.0f, 0.0f);
|
b3Vec3 n1(1.0f, 0.0f, 0.0f);
|
||||||
b3Vec3 v1 = center + radius * n1;
|
b3Vec3 v1 = center + radius * n1;
|
||||||
for (u32 i = 0; i < kEdgeCount; ++i)
|
for (u32 i = 0; i < kEdgeCount; ++i)
|
||||||
@ -475,7 +475,7 @@ void b3QHull::SetAsCone(float32 radius, float32 height)
|
|||||||
float32 kAngleInc = 2.0f * B3_PI / float32(kEdgeCount);
|
float32 kAngleInc = 2.0f * B3_PI / float32(kEdgeCount);
|
||||||
b3Quat q = b3QuatRotationY(kAngleInc);
|
b3Quat q = b3QuatRotationY(kAngleInc);
|
||||||
|
|
||||||
b3Vec3 center(0.0f, 0.0f, 0.0f);
|
b3Vec3 center(0.0f, -0.5f * height, 0.0f);
|
||||||
b3Vec3 n1(1.0f, 0.0f, 0.0f);
|
b3Vec3 n1(1.0f, 0.0f, 0.0f);
|
||||||
b3Vec3 v1 = center + radius * n1;
|
b3Vec3 v1 = center + radius * n1;
|
||||||
for (u32 i = 0; i < kEdgeCount; ++i)
|
for (u32 i = 0; i < kEdgeCount; ++i)
|
||||||
@ -490,7 +490,7 @@ void b3QHull::SetAsCone(float32 radius, float32 height)
|
|||||||
v1 = v2;
|
v1 = v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
vs[count++].Set(0.0f, height, 0.0f);
|
vs[count++].Set(0.0f, 0.5f * height, 0.0f);
|
||||||
|
|
||||||
// Set
|
// Set
|
||||||
Set(vs, count, false);
|
Set(vs, count, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user