Thank you for your reply. Your example will be useful. Waiting forward to your sources.

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
for (int iz = 1; iz < 11; iz++) {
int z = iz * 12;
for (int i = 0; i < 10; i++) {
int x = i * 12;
addHPolygon(box2, x, x + 12, 0, z, z - 12, 1,
tm.getTextureID("floor2"));
}
}
box2.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
box = Loader.load3DS(res.openRawResource(R.raw.crate), 0.095f)[0];
box.setTexture("box1");
box.translate(4, -10, 0);
box.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
Camera cam = world.getCamera();
cam.setPosition(0, -40, 0);
cam.lookAt(new SimpleVector(0, 0, 0));
SimpleVector ray=Interact2D.reproject2D3DWS(world.getCamera(), fb, (int)xpos, (int)ypos);
distance = world.calcMinDistance(world.getCamera().getPosition(), ray, 10000F);
if (distance!=Object3D.COLLISION_NONE) {
SimpleVector offset=new SimpleVector(ray);
ray.scalarMul(distance);
ray=ray.calcSub(offset);
world.getObjectByName("box").translate(world.getCamera().getPosition());
world.getObjectByName("box").translate(ray);
}
Page created in 0.019 seconds with 10 queries.