• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BulletGlobals类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: localGetSupportingVertex

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
@Override
public Vector3 localGetSupportingVertex(Vector3 vec, Vector3 out) {
	Vector3 supVertex = localGetSupportingVertexWithoutMargin(vec, out);

	if (getMargin() != 0f) {
	    Stack stack = Stack.enter();
		Vector3 vecnorm = stack.alloc(vec);
		if (vecnorm.len2() < (BulletGlobals.FLT_EPSILON * BulletGlobals.FLT_EPSILON)) {
			vecnorm.set(-1f, -1f, -1f);
		}
		vecnorm.nor();
		vecnorm.scl(getMargin());
		supVertex.add(vecnorm);
		stack.leave();
	}
	return out;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:18,代码来源:ConvexInternalShape.java


示例2: localGetSupportingVertex

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
@Override
public Vector3 localGetSupportingVertex (Vector3 vec, Vector3 out) {
	Vector3 supVertex = localGetSupportingVertexWithoutMargin(vec, out);

	if (getMargin() != 0f) {
		Stack stack = Stack.enter();
		Vector3 vecnorm = stack.alloc(vec);
		if (vecnorm.len2() < (BulletGlobals.FLT_EPSILON * BulletGlobals.FLT_EPSILON)) {
			vecnorm.set(-1f, -1f, -1f);
		}
		vecnorm.nor();
		vecnorm.scl(getMargin());
		supVertex.add(vecnorm);
		stack.leave();
	}
	return out;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:18,代码来源:ConvexHullShape.java


示例3: coneLocalSupport

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
private Vector3 coneLocalSupport (Vector3 v, Vector3 out) {
	float halfHeight = height * 0.5f;

	if (VectorUtil.getCoord(v, coneIndices[1]) > v.len() * sinAngle) {
		VectorUtil.setCoord(out, coneIndices[0], 0f);
		VectorUtil.setCoord(out, coneIndices[1], halfHeight);
		VectorUtil.setCoord(out, coneIndices[2], 0f);
		return out;
	} else {
		float v0 = VectorUtil.getCoord(v, coneIndices[0]);
		float v2 = VectorUtil.getCoord(v, coneIndices[2]);
		float s = (float)Math.sqrt(v0 * v0 + v2 * v2);
		if (s > BulletGlobals.FLT_EPSILON) {
			float d = radius / s;
			VectorUtil.setCoord(out, coneIndices[0], VectorUtil.getCoord(v, coneIndices[0]) * d);
			VectorUtil.setCoord(out, coneIndices[1], -halfHeight);
			VectorUtil.setCoord(out, coneIndices[2], VectorUtil.getCoord(v, coneIndices[2]) * d);
			return out;
		} else {
			VectorUtil.setCoord(out, coneIndices[0], 0f);
			VectorUtil.setCoord(out, coneIndices[1], -halfHeight);
			VectorUtil.setCoord(out, coneIndices[2], 0f);
			return out;
		}
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:27,代码来源:ConeShape.java


示例4: localGetSupportingVertex

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
@Override
public Vector3 localGetSupportingVertex (Vector3 vec, Vector3 out) {
	Vector3 supVertex = coneLocalSupport(vec, out);
	if (getMargin() != 0f) {
		Stack stack = Stack.enter();
		Vector3 vecnorm = stack.alloc(vec);
		if (vecnorm.len2() < (BulletGlobals.FLT_EPSILON * BulletGlobals.FLT_EPSILON)) {
			vecnorm.set(-1f, -1f, -1f);
		}
		vecnorm.nor();
		vecnorm.scl(getMargin());
		supVertex.add(vecnorm);
		stack.leave();
	}
	return supVertex;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:17,代码来源:ConeShape.java


示例5: setLocalScaling

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
@Override
	public void setLocalScaling (Vector3 scaling) {
		Stack stack = Stack.enter();
		Vector3 tmp = stack.allocVector3();
		tmp.set(getLocalScaling(stack.allocVector3())).sub(scaling);

		if (tmp.len2() > BulletGlobals.SIMD_EPSILON) {
			super.setLocalScaling(scaling);
			/*
			 * if (ownsBvh) { m_bvh->~btOptimizedBvh(); btAlignedFree(m_bvh); }
			 */
			// /m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this
// needs some more work
			bvh = new OptimizedBvh();
			// rebuild the bvh...
			bvh.build(meshInterface, useQuantizedAabbCompression, localAabbMin, localAabbMax);
			ownsBvh = true;
		}
		stack.leave();
	}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:21,代码来源:BvhTriangleMeshShape.java


示例6: setOptimizedBvh

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
public void setOptimizedBvh (OptimizedBvh bvh, Vector3 scaling) {
	assert (this.bvh == null);
	assert (!ownsBvh);

	this.bvh = bvh;
	ownsBvh = false;

	Stack stack = Stack.enter();
	// update the scaling without rebuilding the bvh
	Vector3 tmp = stack.allocVector3();
	tmp.set(getLocalScaling(stack.allocVector3())).sub(scaling);

	if (tmp.len2() > BulletGlobals.SIMD_EPSILON) {
		super.setLocalScaling(scaling);
	}
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:18,代码来源:BvhTriangleMeshShape.java


示例7: localGetSupportingVertex

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
@Override
public Vector3 localGetSupportingVertex (Vector3 vec, Vector3 out) {
	Vector3 supVertex = out;
	localGetSupportingVertexWithoutMargin(vec, supVertex);

	if (getMargin() != 0f) {
		Stack stack = Stack.enter();
		Vector3 vecnorm = stack.alloc(vec);
		if (vecnorm.len2() < (BulletGlobals.SIMD_EPSILON * BulletGlobals.SIMD_EPSILON)) {
			vecnorm.set(-1f, -1f, -1f);
		}
		vecnorm.nor();
		vecnorm.scl(getMargin());
		supVertex.add(vecnorm);
		stack.leave();
	}
	return out;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:19,代码来源:CylinderShape.java


示例8: shortestArcQuat

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
public static Quaternion shortestArcQuat (Vector3 v0, Vector3 v1, Quaternion out) {
	Stack stack = Stack.enter();
	Vector3 c = stack.allocVector3();
	c.set(v0).crs(v1);
	float d = v0.dot(v1);

	if (d < -1.0 + BulletGlobals.FLT_EPSILON) {
		// just pick any vector
		out.set(0.0f, 1.0f, 0.0f, 0.0f);
		stack.leave();
		return out;
	}

	float s = (float)Math.sqrt((1.0f + d) * 2.0f);
	float rs = 1.0f / s;

	out.set(c.x * rs, c.y * rs, c.z * rs, s * 0.5f);
	stack.leave();
	return out;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:21,代码来源:QuaternionUtil.java


示例9: wantsSleeping

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
public boolean wantsSleeping () {
	if (getActivationState() == DISABLE_DEACTIVATION) {
		return false;
	}

	// disable deactivation
	if (BulletGlobals.isDeactivationDisabled() || (BulletGlobals.getDeactivationTime() == 0f)) {
		return false;
	}

	if ((getActivationState() == ISLAND_SLEEPING) || (getActivationState() == WANTS_DEACTIVATION)) {
		return true;
	}

	if (deactivationTime > BulletGlobals.getDeactivationTime()) {
		return true;
	}
	return false;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:20,代码来源:RigidBody.java


示例10: SequentialImpulseConstraintSolver

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
public SequentialImpulseConstraintSolver () {
	BulletGlobals.setContactDestroyedCallback(new ContactDestroyedCallback() {
		public boolean contactDestroyed (Object userPersistentData) {
			assert (userPersistentData != null);
			ConstraintPersistentData cpd = (ConstraintPersistentData)userPersistentData;
			// btAlignedFree(cpd);
			totalCpd--;
			// printf("totalCpd = %i. DELETED Ptr %x\n",totalCpd,userPersistentData);
			return true;
		}
	});

	// initialize default friction/contact funcs
	int i, j;
	for (i = 0; i < MAX_CONTACT_SOLVER_TYPES; i++) {
		for (j = 0; j < MAX_CONTACT_SOLVER_TYPES; j++) {
			contactDispatch[i][j] = ContactConstraint.resolveSingleCollision;
			frictionDispatch[i][j] = ContactConstraint.resolveSingleFriction;
		}
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:22,代码来源:SequentialImpulseConstraintSolver.java


示例11: getRelativeVelocity

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
public float getRelativeVelocity (Vector3 linvelA, Vector3 angvelA, Vector3 linvelB, Vector3 angvelB) {
	Stack stack = Stack.enter();
	Vector3 linrel = stack.allocVector3();
	linrel.set(linvelA).sub(linvelB);

	Vector3 angvela = stack.allocVector3();
	VectorUtil.mul(angvela, angvelA, aJ);

	Vector3 angvelb = stack.allocVector3();
	VectorUtil.mul(angvelb, angvelB, bJ);

	VectorUtil.mul(linrel, linrel, linearJointAxis);

	angvela.add(angvelb);
	angvela.add(linrel);

	float rel_vel2 = angvela.x + angvela.y + angvela.z;
	stack.leave();
	return rel_vel2 + BulletGlobals.FLT_EPSILON;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:21,代码来源:JacobianEntry.java


示例12: setLocalScaling

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
@Override
public void setLocalScaling(Vector3f scaling) {
	Vector3f tmp = Stack.alloc(Vector3f.class);
	tmp.sub(getLocalScaling(Stack.alloc(Vector3f.class)), scaling);

	if (tmp.lengthSquared() > BulletGlobals.SIMD_EPSILON) {
		super.setLocalScaling(scaling);
		/*
		if (ownsBvh)
		{
		m_bvh->~btOptimizedBvh();
		btAlignedFree(m_bvh);
		}
		*/
		///m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this needs some more work
		bvh = new OptimizedBvh();
		// rebuild the bvh...
		bvh.build(meshInterface, useQuantizedAabbCompression, localAabbMin, localAabbMax);
		ownsBvh = true;
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:22,代码来源:BvhTriangleMeshShape.java


示例13: shortestArcQuat

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
public static Quat4f shortestArcQuat(Vector3f v0, Vector3f v1, Quat4f out) {
	Vector3f c = Stack.alloc(Vector3f.class);
	c.cross(v0, v1);
	float d = v0.dot(v1);

	if (d < -1.0 + BulletGlobals.FLT_EPSILON) {
		// just pick any vector
		out.set(0.0f, 1.0f, 0.0f, 0.0f);
		return out;
	}

	float s = (float) Math.sqrt((1.0f + d) * 2.0f);
	float rs = 1.0f / s;

	out.set(c.x * rs, c.y * rs, c.z * rs, s * 0.5f);
	return out;
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:18,代码来源:QuaternionUtil.java


示例14: wantsSleeping

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
public boolean wantsSleeping() {
	if (getActivationState() == DISABLE_DEACTIVATION) {
		return false;
	}

	// disable deactivation
	if (BulletGlobals.isDeactivationDisabled() || (BulletGlobals.getDeactivationTime() == 0f)) {
		return false;
	}

	if ((getActivationState() == ISLAND_SLEEPING) || (getActivationState() == WANTS_DEACTIVATION)) {
		return true;
	}

	if (deactivationTime > BulletGlobals.getDeactivationTime()) {
		return true;
	}
	return false;
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:20,代码来源:RigidBody.java


示例15: SequentialImpulseConstraintSolver

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
public SequentialImpulseConstraintSolver() {
	BulletGlobals.setContactDestroyedCallback(new ContactDestroyedCallback() {
		public boolean contactDestroyed(Object userPersistentData) {
			assert (userPersistentData != null);
			ConstraintPersistentData cpd = (ConstraintPersistentData) userPersistentData;
			//btAlignedFree(cpd);
			totalCpd--;
			//printf("totalCpd = %i. DELETED Ptr %x\n",totalCpd,userPersistentData);
			return true;
		}
	});

	// initialize default friction/contact funcs
	int i, j;
	for (i = 0; i < MAX_CONTACT_SOLVER_TYPES; i++) {
		for (j = 0; j < MAX_CONTACT_SOLVER_TYPES; j++) {
			contactDispatch[i][j] = ContactConstraint.resolveSingleCollision;
			frictionDispatch[i][j] = ContactConstraint.resolveSingleFriction;
		}
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:22,代码来源:SequentialImpulseConstraintSolver.java


示例16: getRelativeVelocity

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
public float getRelativeVelocity(Vector3f linvelA, Vector3f angvelA, Vector3f linvelB, Vector3f angvelB) {
	Vector3f linrel = Stack.alloc(Vector3f.class);
	linrel.sub(linvelA, linvelB);

	Vector3f angvela = Stack.alloc(Vector3f.class);
	VectorUtil.mul(angvela, angvelA, aJ);

	Vector3f angvelb = Stack.alloc(Vector3f.class);
	VectorUtil.mul(angvelb, angvelB, bJ);

	VectorUtil.mul(linrel, linrel, linearJointAxis);

	angvela.add(angvelb);
	angvela.add(linrel);

	float rel_vel2 = angvela.x + angvela.y + angvela.z;
	return rel_vel2 + BulletGlobals.FLT_EPSILON;
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:19,代码来源:JacobianEntry.java


示例17: setLocalScaling

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
@Override
public void setLocalScaling(Vector3f scaling) {
	Vector3f tmp = Stack.alloc(Vector3f.class);
	tmp.sub(getLocalScaling(Stack.alloc(Vector3f.class)), scaling);

	if (tmp.lengthSquared() > BulletGlobals.SIMD_EPSILON) {
		super.setLocalScaling(scaling);
		/*
		if (ownsBvh)
		{
		m_bvh->~btOptimizedBvh();
		btAlignedFree(m_bvh);
		}
		*/
		///m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this needs some more work
		bvh = new OptimizedBvh();
		// rebuild the bvh...
		bvh.build(meshInterface, useQuantizedAabbCompression, localAabbMin, localAabbMax);

	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:22,代码来源:BvhTriangleMeshShape.java


示例18: updateTrigger

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
@ReceiveEvent(components = {TriggerComponent.class, LocationComponent.class})
public void updateTrigger(ChangedComponentEvent event, EntityRef entity) {
    LocationComponent location = entity.getComponent(LocationComponent.class);
    PairCachingGhostObject triggerObj = entityTriggers.get(entity);

    if (triggerObj != null) {
        float scale = location.getWorldScale();
        if (Math.abs(triggerObj.getCollisionShape().getLocalScaling(new Vector3f()).x - scale) > BulletGlobals.SIMD_EPSILON) {
            physics.removeCollider(triggerObj);
            createTrigger(entity);
        } else {
            triggerObj.setWorldTransform(new Transform(new Matrix4f(location.getWorldRotation(), location.getWorldPosition(), 1.0f)));
        }
    }

    // TODO: update if detectGroups changed
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:18,代码来源:PhysicsSystem.java


示例19: updateRigidBody

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
@ReceiveEvent(components = {RigidBodyComponent.class, LocationComponent.class})
public void updateRigidBody(ChangedComponentEvent event, EntityRef entity) {
    LocationComponent location = entity.getComponent(LocationComponent.class);
    RigidBody rigidBody = entityRigidBodies.get(entity);

    if (rigidBody != null) {
        float scale = location.getWorldScale();
        if (Math.abs(rigidBody.getCollisionShape().getLocalScaling(new Vector3f()).x - scale) > BulletGlobals.SIMD_EPSILON) {
            physics.removeRigidBody(rigidBody);
            createRigidBody(entity);
        }

        updateKinematicSettings(entity.getComponent(RigidBodyComponent.class), rigidBody);
    }

    // TODO: update if mass or collision groups change
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:18,代码来源:PhysicsSystem.java


示例20: extractResidualMovement

import com.bulletphysics.BulletGlobals; //导入依赖的package包/类
private Vector3f extractResidualMovement(Vector3f hitNormal, Vector3f direction, float normalMag) {
    float movementLength = direction.length();
    if (movementLength > BulletGlobals.SIMD_EPSILON) {
        direction.normalize();

        Vector3f reflectDir = Vector3fUtil.reflect(direction, hitNormal, new Vector3f());
        reflectDir.normalize();

        Vector3f perpindicularDir = Vector3fUtil.getPerpendicularComponent(reflectDir, hitNormal, new Vector3f());


        if (normalMag != 0.0f) {
            Vector3f perpComponent = new Vector3f();
            perpComponent.scale(normalMag * movementLength, perpindicularDir);
            direction.set(perpComponent);
        }
    }
    return direction;
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:20,代码来源:BulletCharacterMovementSystem.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WorkerSlot类代码示例发布时间:2022-05-23
下一篇:
Java Model类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap