dear raj
thanx for ur kind reply.
the problem is how can draw cubes and postion them randomly. i tried to use arrays such this:
Code:
for(int i=0; i<4; i++)
// {
// randMesh[i] = MeshFactory3D.createCube(false, false, true);
// transformCube[i] = new Transform();
// Mesh curMesh = randMesh[i];
// Transform curTrans = transformCube[i];
//
// curTrans.postTranslate(-5 + r.nextInt(10), -5 + r.nextInt(10), -5 -r.nextInt(20));
//
// // mt.postScale(1, 1, 1);
// graphics.setColor(0x00FFFF); // cyan
// graphics.setStrokeStyle(Graphics.SOLID);
// wireframeEngine.render(graphics,curMesh, curTrans,
// MeshUtils.getLastTriangleIndices(),
// MeshUtils.getLastTriangleLengths());
but it give error! so i ended up creating this function:
Code:
private void createMesh(Mesh meshId,Transform t) {
//Mesh mesh1 = null;
//Mesh meshId = null;
meshId = MeshFactory3D.createCube(false, false, true);
// t.setIdentity();
// t.postRotate(rotx, 1, 0, 0);
// meshId.postRotate(roty, 0, 1, 0);
// t.postTranslate(transx, 0, 0);
// t.postScale(scalex, scalex, scalex);
graphics.setColor(0x00FFFF); // cyan
graphics.setStrokeStyle(Graphics.SOLID);
wireframeEngine.render(graphics, meshId, t,
MeshUtils.getLastTriangleIndices(),
MeshUtils.getLastTriangleLengths());
t.postTranslate(0.2f, 0, 0);
this works and i hace created the function for postions as well which they get called in the init(). cos if i call the the postion function in the render(Graphics g) it will get animated and nanishes! but the disadvatage of this funciton is that i should declare meshes to use in hem which means i cant create infinte number of meshes!
so how far did i reach! i have managed to make 3 meshs appear and disapear after few sec, and it keeps doing it. as i created a class call Clock extends TimerTask(). then created 2 instance of the class clock, and clock1, one for letting the ucbes appear every few sec and the other give a time limit in real sec, to make the game end after 30 sec of example.
the problem is now i really dont know how to make the colision happen. if it is possible for you can you just brifely tell me hte steps.
for ex: if i have a Mesh called mesh. and its tranlasion is posX,posY,posZ. what should i do to make it react ot the touch screen. i just need avery simple one not the xompilcated tutorials which gives alot of varibles and functions. just i wana know where and how to use the ray and pick. and the pointerPressed(int x, int y) will interact with it!
i know it so long im totally sorry but its alot of doubts and if u can tell me why the array is not working i can change the whole code i guess in a better one.
note: THIS IS my run() section:
Code:
int count = 20;
public void run() {
while (move) {
if(clock.getCurTime() > 0 && clock1.getTimeLeft() >= 0){
timelef = clock1.getTimeLeft();
if(count == clock.getCurTime()){
count += 20;
init();
}
animateMeshRot(meshTransform1, rotY); (ainmate function which animstes the transform1.postRorate();)
animateMeshRot(meshTransform, rotY);
animateMeshTrans(meshTransform, 1f);
animateMeshTrans(meshTransform1, 1f);
animateMeshTrans(meshTransform2, 1f);
animateMeshRot(meshTransform2, rotY);
System.out.println(clock.curTime);
}
thanx again