本文整理汇总了Java中com.bulletphysics.collision.dispatch.CollisionObject.getWorldTransform方法的典型用法代码示例。如果您正苦于以下问题:Java CollisionObject.getWorldTransform方法的具体用法?Java CollisionObject.getWorldTransform怎么用?Java CollisionObject.getWorldTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bulletphysics.collision.dispatch.CollisionObject
的用法示例。
在下文中一共展示了CollisionObject.getWorldTransform方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gimpact_vs_compoundshape
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void gimpact_vs_compoundshape(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, CompoundShape shape1, boolean swapped) {
Stack stack = Stack.enter();
Transform orgtrans1 = body1.getWorldTransform(stack.allocTransform());
Transform childtrans1 = stack.allocTransform();
Transform tmpTrans = stack.allocTransform();
int i = shape1.getNumChildShapes();
while ((i--) != 0) {
CollisionShape colshape1 = shape1.getChildShape(i);
childtrans1.mul(orgtrans1, shape1.getChildTransform(i, tmpTrans));
body1.setWorldTransform(childtrans1);
// collide child shape
gimpact_vs_shape(body0, body1,
shape0, colshape1, swapped);
// restore transforms
body1.setWorldTransform(orgtrans1);
}
stack.leave();
}
示例2: gimpact_vs_concave
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void gimpact_vs_concave(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, ConcaveShape shape1, boolean swapped) {
// create the callback
GImpactTriangleCallback tricallback = new GImpactTriangleCallback();
tricallback.algorithm = this;
tricallback.body0 = body0;
tricallback.body1 = body1;
tricallback.gimpactshape0 = shape0;
tricallback.swapped = swapped;
tricallback.margin = shape1.getMargin();
// getting the trimesh AABB
Stack stack = Stack.enter();
Transform gimpactInConcaveSpace = stack.allocTransform();
body1.getWorldTransform(gimpactInConcaveSpace);
gimpactInConcaveSpace.inverse();
gimpactInConcaveSpace.mul(body0.getWorldTransform(stack.allocTransform()));
Vector3 minAABB = stack.allocVector3(), maxAABB = stack.allocVector3();
shape0.getAabb(gimpactInConcaveSpace, minAABB, maxAABB);
shape1.processAllTriangles(tricallback, minAABB, maxAABB);
stack.leave();
}
示例3: gimpact_vs_compoundshape
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void gimpact_vs_compoundshape(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, CompoundShape shape1, boolean swapped) {
Transform orgtrans1 = body1.getWorldTransform(Stack.alloc(Transform.class));
Transform childtrans1 = Stack.alloc(Transform.class);
Transform tmpTrans = Stack.alloc(Transform.class);
int i = shape1.getNumChildShapes();
while ((i--) != 0) {
CollisionShape colshape1 = shape1.getChildShape(i);
childtrans1.mul(orgtrans1, shape1.getChildTransform(i, tmpTrans));
body1.setWorldTransform(childtrans1);
// collide child shape
gimpact_vs_shape(body0, body1,
shape0, colshape1, swapped);
// restore transforms
body1.setWorldTransform(orgtrans1);
}
}
示例4: gimpact_vs_concave
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void gimpact_vs_concave(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, ConcaveShape shape1, boolean swapped) {
// create the callback
GImpactTriangleCallback tricallback = new GImpactTriangleCallback();
tricallback.algorithm = this;
tricallback.body0 = body0;
tricallback.body1 = body1;
tricallback.gimpactshape0 = shape0;
tricallback.swapped = swapped;
tricallback.margin = shape1.getMargin();
// getting the trimesh AABB
Transform gimpactInConcaveSpace = Stack.alloc(Transform.class);
body1.getWorldTransform(gimpactInConcaveSpace);
gimpactInConcaveSpace.inverse();
gimpactInConcaveSpace.mul(body0.getWorldTransform(Stack.alloc(Transform.class)));
Vector3f minAABB = Stack.alloc(Vector3f.class), maxAABB = Stack.alloc(Vector3f.class);
shape0.getAabb(gimpactInConcaveSpace, minAABB, maxAABB);
shape1.processAllTriangles(tricallback, minAABB, maxAABB);
}
示例5: gimpact_vs_compoundshape
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void gimpact_vs_compoundshape(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, CompoundShape shape1, boolean swapped) {
System.out.println("gimpact_vs_compoundshape");
Transform orgtrans1 = body1.getWorldTransform(Stack.alloc(Transform.class));
Transform childtrans1 = Stack.alloc(Transform.class);
Transform tmpTrans = Stack.alloc(Transform.class);
int i = shape1.getNumChildShapes();
while ((i--) != 0) {
CollisionShape colshape1 = shape1.getChildShape(i);
childtrans1.mul(orgtrans1, shape1.getChildTransform(i, tmpTrans));
body1.setWorldTransform(childtrans1);
// collide child shape
gimpact_vs_shape(body0, body1,
shape0, colshape1, swapped);
// restore transforms
body1.setWorldTransform(orgtrans1);
}
}
示例6: gimpact_vs_concave
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void gimpact_vs_concave(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, ConcaveShape shape1, boolean swapped) {
System.out.println("gimpact_vs_concave");
// create the callback
GImpactTriangleCallback tricallback = new GImpactTriangleCallback();
tricallback.algorithm = this;
tricallback.body0 = body0;
tricallback.body1 = body1;
tricallback.gimpactshape0 = shape0;
tricallback.swapped = swapped;
tricallback.margin = shape1.getMargin();
// getting the trimesh AABB
Transform gimpactInConcaveSpace = Stack.alloc(Transform.class);
body1.getWorldTransform(gimpactInConcaveSpace);
gimpactInConcaveSpace.inverse();
gimpactInConcaveSpace.mul(body0.getWorldTransform(Stack.alloc(Transform.class)));
Vector3f minAABB = Stack.alloc(Vector3f.class), maxAABB = Stack.alloc(Vector3f.class);
shape0.getAabb(gimpactInConcaveSpace, minAABB, maxAABB);
shape1.processAllTriangles(tricallback, minAABB, maxAABB);
}
示例7: collide_sat_triangles
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
void collide_sat_triangles(CollisionObject body0, CollisionObject body1, GImpactMeshShapePart shape0, GImpactMeshShapePart shape1, PairSet pairs, int pair_count) {
Stack stack = Stack.enter();
Vector3 tmp = stack.allocVector3();
Transform orgtrans0 = body0.getWorldTransform(stack.allocTransform());
Transform orgtrans1 = body1.getWorldTransform(stack.allocTransform());
PrimitiveTriangle ptri0 = stack.allocPrimitiveTriangle();
PrimitiveTriangle ptri1 = stack.allocPrimitiveTriangle();
TriangleContact contact_data = stack.allocTriangleContact();
shape0.lockChildShapes();
shape1.lockChildShapes();
int pair_pointer = 0;
while ((pair_count--) != 0) {
//triface0 = pairs.get(pair_pointer);
//triface1 = pairs.get(pair_pointer + 1);
//pair_pointer += 2;
Pair pair = pairs.get(pair_pointer++);
triface0 = pair.index1;
triface1 = pair.index2;
shape0.getPrimitiveTriangle(triface0, ptri0);
shape1.getPrimitiveTriangle(triface1, ptri1);
//#ifdef TRI_COLLISION_PROFILING
//bt_begin_gim02_tri_time();
//#endif
ptri0.applyTransform(orgtrans0);
ptri1.applyTransform(orgtrans1);
// build planes
ptri0.buildTriPlane();
ptri1.buildTriPlane();
// test conservative
if (ptri0.overlap_test_conservative(ptri1)) {
if (ptri0.find_triangle_collision_clip_method(ptri1, contact_data)) {
int j = contact_data.point_count;
while ((j--) != 0) {
tmp.x = contact_data.separating_normal.x;
tmp.y = contact_data.separating_normal.y;
tmp.z = contact_data.separating_normal.z;
addContactPoint(body0, body1,
contact_data.points[j],
tmp,
-contact_data.penetration_depth);
}
}
}
//#ifdef TRI_COLLISION_PROFILING
//bt_end_gim02_tri_time();
//#endif
}
shape0.unlockChildShapes();
shape1.unlockChildShapes();
stack.leave();
}
示例8: gimpacttrimeshpart_vs_plane_collision
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
protected void gimpacttrimeshpart_vs_plane_collision(CollisionObject body0, CollisionObject body1, GImpactMeshShapePart shape0, StaticPlaneShape shape1, boolean swapped) {
Stack stack = Stack.enter();
Transform orgtrans0 = body0.getWorldTransform(stack.allocTransform());
Transform orgtrans1 = body1.getWorldTransform(stack.allocTransform());
StaticPlaneShape planeshape = shape1;
Quaternion plane = stack.allocQuaternion();
PlaneShape.get_plane_equation_transformed(planeshape, orgtrans1, plane);
// test box against plane
AABB tribox = stack.allocAABB();
shape0.getAabb(orgtrans0, tribox.min, tribox.max);
tribox.increment_margin(planeshape.getMargin());
if (tribox.plane_classify(plane) != PlaneIntersectionType.COLLIDE_PLANE) {
return;
}
shape0.lockChildShapes();
float margin = shape0.getMargin() + planeshape.getMargin();
Vector3 vertex = stack.allocVector3();
Vector3 tmp = stack.allocVector3();
int vi = shape0.getVertexCount();
while ((vi--) != 0) {
shape0.getVertex(vi, vertex);
orgtrans0.transform(vertex);
float distance = VectorUtil.dot3(vertex, plane) - plane.w - margin;
if (distance < 0f)//add contact
{
if (swapped) {
tmp.set(-plane.x, -plane.y, -plane.z);
addContactPoint(body1, body0, vertex, tmp, distance);
}
else {
tmp.set(plane.x, plane.y, plane.z);
addContactPoint(body0, body1, vertex, tmp, distance);
}
}
}
shape0.unlockChildShapes();
stack.leave();
}
示例9: collide_sat_triangles
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
void collide_sat_triangles(CollisionObject body0, CollisionObject body1, GImpactMeshShapePart shape0, GImpactMeshShapePart shape1, PairSet pairs, int pair_count) {
Vector3f tmp = Stack.alloc(Vector3f.class);
Transform orgtrans0 = body0.getWorldTransform(Stack.alloc(Transform.class));
Transform orgtrans1 = body1.getWorldTransform(Stack.alloc(Transform.class));
PrimitiveTriangle ptri0 = Stack.alloc(PrimitiveTriangle.class);
PrimitiveTriangle ptri1 = Stack.alloc(PrimitiveTriangle.class);
TriangleContact contact_data = Stack.alloc(TriangleContact.class);
shape0.lockChildShapes();
shape1.lockChildShapes();
int pair_pointer = 0;
while ((pair_count--) != 0) {
//triface0 = pairs.get(pair_pointer);
//triface1 = pairs.get(pair_pointer + 1);
//pair_pointer += 2;
Pair pair = pairs.get(pair_pointer++);
triface0 = pair.index1;
triface1 = pair.index2;
shape0.getPrimitiveTriangle(triface0, ptri0);
shape1.getPrimitiveTriangle(triface1, ptri1);
//#ifdef TRI_COLLISION_PROFILING
//bt_begin_gim02_tri_time();
//#endif
ptri0.applyTransform(orgtrans0);
ptri1.applyTransform(orgtrans1);
// build planes
ptri0.buildTriPlane();
ptri1.buildTriPlane();
// test conservative
if (ptri0.overlap_test_conservative(ptri1)) {
if (ptri0.find_triangle_collision_clip_method(ptri1, contact_data)) {
int j = contact_data.point_count;
while ((j--) != 0) {
tmp.x = contact_data.separating_normal.x;
tmp.y = contact_data.separating_normal.y;
tmp.z = contact_data.separating_normal.z;
addContactPoint(body0, body1,
contact_data.points[j],
tmp,
-contact_data.penetration_depth);
}
}
}
//#ifdef TRI_COLLISION_PROFILING
//bt_end_gim02_tri_time();
//#endif
}
shape0.unlockChildShapes();
shape1.unlockChildShapes();
}
示例10: gimpacttrimeshpart_vs_plane_collision
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
protected void gimpacttrimeshpart_vs_plane_collision(CollisionObject body0, CollisionObject body1, GImpactMeshShapePart shape0, StaticPlaneShape shape1, boolean swapped) {
Transform orgtrans0 = body0.getWorldTransform(Stack.alloc(Transform.class));
Transform orgtrans1 = body1.getWorldTransform(Stack.alloc(Transform.class));
StaticPlaneShape planeshape = shape1;
Vector4f plane = Stack.alloc(Vector4f.class);
PlaneShape.get_plane_equation_transformed(planeshape, orgtrans1, plane);
// test box against plane
AABB tribox = Stack.alloc(AABB.class);
shape0.getAabb(orgtrans0, tribox.min, tribox.max);
tribox.increment_margin(planeshape.getMargin());
if (tribox.plane_classify(plane) != PlaneIntersectionType.COLLIDE_PLANE) {
return;
}
shape0.lockChildShapes();
float margin = shape0.getMargin() + planeshape.getMargin();
Vector3f vertex = Stack.alloc(Vector3f.class);
Vector3f tmp = Stack.alloc(Vector3f.class);
int vi = shape0.getVertexCount();
while ((vi--) != 0) {
shape0.getVertex(vi, vertex);
orgtrans0.transform(vertex);
float distance = VectorUtil.dot3(vertex, plane) - plane.w - margin;
if (distance < 0f)//add contact
{
if (swapped) {
tmp.set(-plane.x, -plane.y, -plane.z);
addContactPoint(body1, body0, vertex, tmp, distance);
}
else {
tmp.set(plane.x, plane.y, plane.z);
addContactPoint(body0, body1, vertex, tmp, distance);
}
}
}
shape0.unlockChildShapes();
}