當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。