当前位置: 首页>>代码示例>>Java>>正文


Java CastResult类代码示例

本文整理汇总了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;
		}
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:23,代码来源:ConvexConcaveCollisionAlgorithm.java

示例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;
		}
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:23,代码来源:ConvexConcaveCollisionAlgorithm.java

示例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);
			}
		}
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:37,代码来源:TriangleConvexcastCallback.java

示例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);
			}
		}
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:43,代码来源:TriangleConvexcastCallback.java


注:本文中的com.bulletphysics.collision.narrowphase.ConvexCast.CastResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。