本文整理汇总了Java中com.bulletphysics.collision.narrowphase.ManifoldPoint类的典型用法代码示例。如果您正苦于以下问题:Java ManifoldPoint类的具体用法?Java ManifoldPoint怎么用?Java ManifoldPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ManifoldPoint类属于com.bulletphysics.collision.narrowphase包,在下文中一共展示了ManifoldPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: solveCombinedContactFriction
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
public float solveCombinedContactFriction (RigidBody body0, RigidBody body1, ManifoldPoint cp, ContactSolverInfo info,
int iter, IDebugDraw debugDrawer) {
float maxImpulse = 0f;
{
if (cp.getDistance() <= 0f) {
{
// btConstraintPersistentData* cpd = (btConstraintPersistentData*) cp.m_userPersistentData;
float impulse = ContactConstraint.resolveSingleCollisionCombined(body0, body1, cp, info);
if (maxImpulse < impulse) {
maxImpulse = impulse;
}
}
}
}
return maxImpulse;
}
示例2: solve
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
protected float solve (RigidBody body0, RigidBody body1, ManifoldPoint cp, ContactSolverInfo info, int iter,
IDebugDraw debugDrawer) {
float maxImpulse = 0f;
{
if (cp.getDistance() <= 0f) {
{
ConstraintPersistentData cpd = (ConstraintPersistentData)cp.userPersistentData;
float impulse = cpd.contactSolverFunc.resolveContact(body0, body1, cp, info);
if (maxImpulse < impulse) {
maxImpulse = impulse;
}
}
}
}
return maxImpulse;
}
示例3: solveCombinedContactFriction
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
public float solveCombinedContactFriction(RigidBody body0, RigidBody body1, ManifoldPoint cp, ContactSolverInfo info, int iter, IDebugDraw debugDrawer) {
float maxImpulse = 0f;
{
if (cp.getDistance() <= 0f) {
{
//btConstraintPersistentData* cpd = (btConstraintPersistentData*) cp.m_userPersistentData;
float impulse = ContactConstraint.resolveSingleCollisionCombined(body0, body1, cp, info);
if (maxImpulse < impulse) {
maxImpulse = impulse;
}
}
}
}
return maxImpulse;
}
示例4: solve
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
protected float solve(RigidBody body0, RigidBody body1, ManifoldPoint cp, ContactSolverInfo info, int iter, IDebugDraw debugDrawer) {
float maxImpulse = 0f;
{
if (cp.getDistance() <= 0f) {
{
ConstraintPersistentData cpd = (ConstraintPersistentData) cp.userPersistentData;
float impulse = cpd.contactSolverFunc.resolveContact(body0, body1, cp, info);
if (maxImpulse < impulse) {
maxImpulse = impulse;
}
}
}
}
return maxImpulse;
}
示例5: contactProcessed
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
@Override
public boolean contactProcessed(ManifoldPoint arg0, Object obj1, Object obj2)
{
CollisionObject o1 = (CollisionObject) obj1;
CollisionObject o2 = (CollisionObject) obj2;
for (PhysicsBody body : watchList)
{
if (body.body == o1)
{
body.collidedWith(o2);
}
else if (body.body == o2)
{
body.collidedWith(o1);
}
}
return false;
}
示例6: contactAdded
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
public boolean contactAdded(ManifoldPoint cp, CollisionObject colObj0, int partId0, int index0, CollisionObject colObj1, int partId1, int index1) {
float friction0 = colObj0.getFriction();
float friction1 = colObj1.getFriction();
float restitution0 = colObj0.getRestitution();
float restitution1 = colObj1.getRestitution();
if ((colObj0.getCollisionFlags() & CollisionFlags.CUSTOM_MATERIAL_CALLBACK) != 0) {
friction0 = 1f; //partId0,index0
restitution0 = 0f;
}
if ((colObj1.getCollisionFlags() & CollisionFlags.CUSTOM_MATERIAL_CALLBACK) != 0) {
if ((index1 & 1) != 0) {
friction1 = 1f; //partId1,index1
}
else {
friction1 = 0f;
}
restitution1 = 0f;
}
cp.combinedFriction = calculateCombinedFriction(friction0, friction1);
cp.combinedRestitution = calculateCombinedRestitution(restitution0, restitution1);
// this return value is currently ignored, but to be on the safe side: return false if you don't calculate friction
return true;
}
示例7: update
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
public static void update() {
world.stepSimulation(Time.getDeltaSeconds());
for (PersistentManifold pm : world.getDispatcher().getInternalManifoldPointer()) {
GameObject objectA = (GameObject)((CollisionObject)pm.getBody0()).getUserPointer();
GameObject objectB = (GameObject)((CollisionObject)pm.getBody1()).getUserPointer();
if (objectA != null && objectB != null) {
for (int contactId = 0; contactId < pm.getNumContacts(); contactId++) {
ManifoldPoint mp = pm.getContactPoint(contactId);
if (mp.getDistance() < 0.0f) {
objectA.onCollision(mp,objectB);
}
}
}
}
}
示例8: getEvent
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
public PhysicsCollisionEvent getEvent(int type, PhysicsCollisionObject source, PhysicsCollisionObject nodeB, ManifoldPoint cp) {
PhysicsCollisionEvent event = eventBuffer.poll();
if (event == null) {
event = new PhysicsCollisionEvent(type, source, nodeB, cp);
}else{
event.refactor(type, source, nodeB, cp);
}
return event;
}
示例9: PhysicsCollisionEvent
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
public PhysicsCollisionEvent(int type, PhysicsCollisionObject source, PhysicsCollisionObject nodeB, ManifoldPoint cp) {
super(source);
this.type = type;
this.nodeA = source;
this.nodeB = nodeB;
this.cp = cp;
}
示例10: refactor
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
/**
* used by event factory, called when event reused
*/
public void refactor(int type, PhysicsCollisionObject source, PhysicsCollisionObject nodeB, ManifoldPoint cp) {
this.source = source;
this.type = type;
this.nodeA = source;
this.nodeB = nodeB;
this.cp = cp;
}
示例11: solveFriction
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
protected float solveFriction (RigidBody body0, RigidBody body1, ManifoldPoint cp, ContactSolverInfo info, int iter,
IDebugDraw debugDrawer) {
{
if (cp.getDistance() <= 0f) {
ConstraintPersistentData cpd = (ConstraintPersistentData)cp.userPersistentData;
cpd.frictionSolverFunc.resolveContact(body0, body1, cp, info);
}
}
return 0f;
}
示例12: resolveSingleFrictionEmpty
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
public static float resolveSingleFrictionEmpty(
RigidBody body1,
RigidBody body2,
ManifoldPoint contactPoint,
ContactSolverInfo solverInfo) {
return 0f;
}
示例13: solveFriction
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
protected float solveFriction(RigidBody body0, RigidBody body1, ManifoldPoint cp, ContactSolverInfo info, int iter, IDebugDraw debugDrawer) {
{
if (cp.getDistance() <= 0f) {
ConstraintPersistentData cpd = (ConstraintPersistentData) cp.userPersistentData;
cpd.frictionSolverFunc.resolveContact(body0, body1, cp, info);
}
}
return 0f;
}
示例14: onCollision
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
@Override
public void onCollision(ManifoldPoint mp, GameObject object) {
// TODO: check if impact material is equal to "material"
// TODO: check how hard the impact is, should include "mass" in the calculation
final float lowerLimit = 20.0f;
final float upperLimit = 100.0f;
if (mp.appliedImpulse > lowerLimit) {
int soundId = 0;
if (mp.appliedImpulse >= upperLimit) {
soundId = impacts.length - 1;
} else {
soundId = (int)(((mp.appliedImpulse - lowerLimit) / (upperLimit - lowerLimit)) * (float)impacts.length);
}
Sound impactSound = impacts[soundId];
if (!impactSound.isPlaying()) {
javax.vecmath.Vector3f pos = new javax.vecmath.Vector3f();
mp.getPositionWorldOnA(pos );
impactSound.setPosition(new Vector3f(pos.x, pos.y, pos.z));
impactSound.play();
}
}
}
示例15: get
import com.bulletphysics.collision.narrowphase.ManifoldPoint; //导入依赖的package包/类
@Override
public ManifoldPoint get() {
return new ManifoldPoint();
}