本文整理汇总了Java中com.bulletphysics.collision.narrowphase.ConvexCast.CastResult类的典型用法代码示例。如果您正苦于以下问题:Java CastResult类的具体用法?Java CastResult怎么用?Java CastResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CastResult类属于com.bulletphysics.collision.narrowphase.ConvexCast包,在下文中一共展示了CastResult类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processTriangle
import com.bulletphysics.collision.narrowphase.ConvexCast.CastResult; //导入依赖的package包/类
public void processTriangle (Vector3[] triangle, int partId, int triangleIndex) {
// do a swept sphere for now
// btTransform ident;
// ident.setIdentity();
CastResult castResult = new CastResult();
castResult.fraction = hitFraction;
SphereShape pointShape = new SphereShape(ccdSphereRadius);
TriangleShape triShape = new TriangleShape(triangle[0], triangle[1], triangle[2]);
VoronoiSimplexSolver simplexSolver = new VoronoiSimplexSolver();
SubsimplexConvexCast convexCaster = new SubsimplexConvexCast(pointShape, triShape, simplexSolver);
// GjkConvexCast convexCaster(&pointShape,convexShape,&simplexSolver);
// ContinuousConvexCollision convexCaster(&pointShape,convexShape,&simplexSolver,0);
// local space?
if (convexCaster.calcTimeOfImpact(ccdSphereFromTrans, ccdSphereToTrans, ident, ident, castResult)) {
if (hitFraction > castResult.fraction) {
hitFraction = castResult.fraction;
}
}
}
示例2: processTriangle
import com.bulletphysics.collision.narrowphase.ConvexCast.CastResult; //导入依赖的package包/类
public void processTriangle(Vector3f[] triangle, int partId, int triangleIndex) {
// do a swept sphere for now
//btTransform ident;
//ident.setIdentity();
CastResult castResult = new CastResult();
castResult.fraction = hitFraction;
SphereShape pointShape = new SphereShape(ccdSphereRadius);
TriangleShape triShape = new TriangleShape(triangle[0], triangle[1], triangle[2]);
VoronoiSimplexSolver simplexSolver = new VoronoiSimplexSolver();
SubsimplexConvexCast convexCaster = new SubsimplexConvexCast(pointShape, triShape, simplexSolver);
//GjkConvexCast convexCaster(&pointShape,convexShape,&simplexSolver);
//ContinuousConvexCollision convexCaster(&pointShape,convexShape,&simplexSolver,0);
//local space?
if (convexCaster.calcTimeOfImpact(ccdSphereFromTrans, ccdSphereToTrans, ident, ident, castResult)) {
if (hitFraction > castResult.fraction) {
hitFraction = castResult.fraction;
}
}
}
示例3: processTriangle
import com.bulletphysics.collision.narrowphase.ConvexCast.CastResult; //导入依赖的package包/类
public void processTriangle (Vector3[] triangle, int partId, int triangleIndex) {
TriangleShape triangleShape = new TriangleShape(triangle[0], triangle[1], triangle[2]);
triangleShape.setMargin(triangleCollisionMargin);
VoronoiSimplexSolver simplexSolver = new VoronoiSimplexSolver();
GjkEpaPenetrationDepthSolver gjkEpaPenetrationSolver = new GjkEpaPenetrationDepthSolver();
// #define USE_SUBSIMPLEX_CONVEX_CAST 1
// if you reenable USE_SUBSIMPLEX_CONVEX_CAST see commented out code below
// #ifdef USE_SUBSIMPLEX_CONVEX_CAST
// TODO: implement ContinuousConvexCollision
SubsimplexConvexCast convexCaster = new SubsimplexConvexCast(convexShape, triangleShape, simplexSolver);
// #else
// //btGjkConvexCast convexCaster(m_convexShape,&triangleShape,&simplexSolver);
// btContinuousConvexCollision convexCaster(m_convexShape,&triangleShape,&simplexSolver,&gjkEpaPenetrationSolver);
// #endif //#USE_SUBSIMPLEX_CONVEX_CAST
CastResult castResult = new CastResult();
castResult.fraction = 1f;
if (convexCaster.calcTimeOfImpact(convexShapeFrom, convexShapeTo, triangleToWorld, triangleToWorld, castResult)) {
// add hit
if (castResult.normal.len2() > 0.0001f) {
if (castResult.fraction < hitFraction) {
/* btContinuousConvexCast's normal is already in world space */
/*
* //#ifdef USE_SUBSIMPLEX_CONVEX_CAST // rotate normal into worldspace
* convexShapeFrom.basis.transform(castResult.normal); //#endif //USE_SUBSIMPLEX_CONVEX_CAST
*/
castResult.normal.nor();
reportHit(castResult.normal, castResult.hitPoint, castResult.fraction, partId, triangleIndex);
}
}
}
}
示例4: processTriangle
import com.bulletphysics.collision.narrowphase.ConvexCast.CastResult; //导入依赖的package包/类
public void processTriangle(Vector3f[] triangle, int partId, int triangleIndex) {
TriangleShape triangleShape = new TriangleShape(triangle[0], triangle[1], triangle[2]);
triangleShape.setMargin(triangleCollisionMargin);
VoronoiSimplexSolver simplexSolver = new VoronoiSimplexSolver();
GjkEpaPenetrationDepthSolver gjkEpaPenetrationSolver = new GjkEpaPenetrationDepthSolver();
//#define USE_SUBSIMPLEX_CONVEX_CAST 1
//if you reenable USE_SUBSIMPLEX_CONVEX_CAST see commented out code below
//#ifdef USE_SUBSIMPLEX_CONVEX_CAST
// TODO: implement ContinuousConvexCollision
SubsimplexConvexCast convexCaster = new SubsimplexConvexCast(convexShape, triangleShape, simplexSolver);
//#else
// //btGjkConvexCast convexCaster(m_convexShape,&triangleShape,&simplexSolver);
//btContinuousConvexCollision convexCaster(m_convexShape,&triangleShape,&simplexSolver,&gjkEpaPenetrationSolver);
//#endif //#USE_SUBSIMPLEX_CONVEX_CAST
CastResult castResult = new CastResult();
castResult.fraction = 1f;
if (convexCaster.calcTimeOfImpact(convexShapeFrom, convexShapeTo, triangleToWorld, triangleToWorld, castResult)) {
// add hit
if (castResult.normal.lengthSquared() > 0.0001f) {
if (castResult.fraction < hitFraction) {
/* btContinuousConvexCast's normal is already in world space */
/*
//#ifdef USE_SUBSIMPLEX_CONVEX_CAST
// rotate normal into worldspace
convexShapeFrom.basis.transform(castResult.normal);
//#endif //USE_SUBSIMPLEX_CONVEX_CAST
*/
castResult.normal.normalize();
reportHit(castResult.normal,
castResult.hitPoint,
castResult.fraction,
partId,
triangleIndex);
}
}
}
}