本文整理汇总了C#中BulletX.LinerMath.btVector3.getX方法的典型用法代码示例。如果您正苦于以下问题:C# btVector3.getX方法的具体用法?C# btVector3.getX怎么用?C# btVector3.getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BulletX.LinerMath.btVector3
的用法示例。
在下文中一共展示了btVector3.getX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: localGetSupportVertexWithoutMarginNonVirtual
public void localGetSupportVertexWithoutMarginNonVirtual(ref btVector3 localDir,out btVector3 result)
{
switch (ShapeType)
{
case BroadphaseNativeTypes.SPHERE_SHAPE_PROXYTYPE:
{
result= btVector3.Zero;
return;
}
case BroadphaseNativeTypes.BOX_SHAPE_PROXYTYPE:
{
BoxShape convexShape = (BoxShape)this;
btVector3 halfExtents = convexShape.ImplicitShapeDimensions;
//btFsel(btScalar a, btScalar b, btScalar c) return a >= 0 ? b : c;
result= new btVector3(localDir.X >= 0 ? halfExtents.X : -halfExtents.X,
localDir.Y >= 0 ? halfExtents.Y : -halfExtents.Y,
localDir.Z >= 0 ? halfExtents.Z : -halfExtents.Z);
return;
}
case BroadphaseNativeTypes.TRIANGLE_SHAPE_PROXYTYPE:
{
throw new NotImplementedException("Traiangle Shape is not Implemented");
#if false
TriangleShape triangleShape = (TriangleShape)this;
btVector3 dir(localDir.getX(),localDir.getY(),localDir.getZ());
btVector3* vertices = &triangleShape->m_vertices1[0];
btVector3 dots(dir.dot(vertices[0]), dir.dot(vertices[1]), dir.dot(vertices[2]));
btVector3 sup = vertices[dots.maxAxis()];
return btVector3(sup.getX(),sup.getY(),sup.getZ());
#endif
}
case BroadphaseNativeTypes.CYLINDER_SHAPE_PROXYTYPE:
{
throw new NotImplementedException("Cylinder Shape is not Implemented");
#if false
btCylinderShape* cylShape = (btCylinderShape*)this;
//mapping of halfextents/dimension onto radius/height depends on how cylinder local orientation is (upAxis)
btVector3 halfExtents = cylShape->getImplicitShapeDimensions();
btVector3 v(localDir.getX(),localDir.getY(),localDir.getZ());
int cylinderUpAxis = cylShape->getUpAxis();
int XX(1),YY(0),ZZ(2);
switch (cylinderUpAxis)
{
case 0:
{
XX = 1;
YY = 0;
ZZ = 2;
}
break;
case 1:
{
XX = 0;
YY = 1;
ZZ = 2;
}
break;
case 2:
{
XX = 0;
YY = 2;
ZZ = 1;
}
break;
default:
btAssert(0);
break;
};
btScalar radius = halfExtents[XX];
btScalar halfHeight = halfExtents[cylinderUpAxis];
btVector3 tmp;
btScalar d ;
btScalar s = btSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
if (s != btScalar(0.0))
{
d = radius / s;
tmp[XX] = v[XX] * d;
tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
tmp[ZZ] = v[ZZ] * d;
return btVector3(tmp.getX(),tmp.getY(),tmp.getZ());
} else {
tmp[XX] = radius;
tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
tmp[ZZ] = btScalar(0.0);
return btVector3(tmp.getX(),tmp.getY(),tmp.getZ());
}
#endif
}
case BroadphaseNativeTypes.CAPSULE_SHAPE_PROXYTYPE:
{
btVector3 vec0 = localDir;
CapsuleShape capsuleShape = (CapsuleShape)this;
//.........这里部分代码省略.........