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


Java BulletGlobals.CONVEX_DISTANCE_MARGIN属性代码示例

本文整理汇总了Java中com.bulletphysics.BulletGlobals.CONVEX_DISTANCE_MARGIN属性的典型用法代码示例。如果您正苦于以下问题:Java BulletGlobals.CONVEX_DISTANCE_MARGIN属性的具体用法?Java BulletGlobals.CONVEX_DISTANCE_MARGIN怎么用?Java BulletGlobals.CONVEX_DISTANCE_MARGIN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.bulletphysics.BulletGlobals的用法示例。


在下文中一共展示了BulletGlobals.CONVEX_DISTANCE_MARGIN属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateLocalInertia

@Override
public void calculateLocalInertia (float mass, Vector3 inertia) {
	// as an approximation, take the inertia of the box that bounds the spheres

	Stack stack = Stack.enter();
	Transform ident = stack.allocTransform();
	ident.setIdentity();

	float radius = getRadius();

	Vector3 halfExtents = stack.allocVector3();
	halfExtents.set(radius, radius, radius);
	VectorUtil.setCoord(halfExtents, getUpAxis(), radius + getHalfHeight());

	float margin = BulletGlobals.CONVEX_DISTANCE_MARGIN;

	float lx = 2f * (halfExtents.x + margin);
	float ly = 2f * (halfExtents.y + margin);
	float lz = 2f * (halfExtents.z + margin);
	float x2 = lx * lx;
	float y2 = ly * ly;
	float z2 = lz * lz;
	float scaledmass = mass * 0.08333333f;

	inertia.x = scaledmass * (y2 + z2);
	inertia.y = scaledmass * (x2 + z2);
	inertia.z = scaledmass * (x2 + y2);
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:29,代码来源:CapsuleShape.java

示例2: calculateLocalInertia

@Override
public void calculateLocalInertia(float mass, Vector3f inertia) {
	// as an approximation, take the inertia of the box that bounds the spheres

	Transform ident = Stack.alloc(Transform.class);
	ident.setIdentity();

	float radius = getRadius();

	Vector3f halfExtents = Stack.alloc(Vector3f.class);
	halfExtents.set(radius, radius, radius);
	VectorUtil.setCoord(halfExtents, getUpAxis(), radius + getHalfHeight());

	float margin = BulletGlobals.CONVEX_DISTANCE_MARGIN;

	float lx = 2f * (halfExtents.x + margin);
	float ly = 2f * (halfExtents.y + margin);
	float lz = 2f * (halfExtents.z + margin);
	float x2 = lx * lx;
	float y2 = ly * ly;
	float z2 = lz * lz;
	float scaledmass = mass * 0.08333333f;

	inertia.x = scaledmass * (y2 + z2);
	inertia.y = scaledmass * (x2 + z2);
	inertia.z = scaledmass * (x2 + y2);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:27,代码来源:CapsuleShape.java


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