×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    m3g problem pls hel-p

    can some one help me..

    I’m using immediate mode. How can i randomly place meshes (cubes) on screen in different timing? As the game concept is about cubes pops up on the screen and the person touch them to disappear. i want hte cubes to reamin for few sec then disappear then other comes in diffrent positions and so on.

    whenever i add codes in the render(Graphics g) section the content disapears and comes back again! and if i add tranformation the content gets animated by it self!


    How can i use the touch screen and verify the cubes coordinate! so i can check the collision.

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: m3g problem pls hel-p

    Quote Originally Posted by smileii View Post
    can some one help me..

    0.How can i randomly place meshes (cubes) on screen in different timing?
    1.i want hte cubes to reamin for few sec then disappear then other comes in diffrent positions and so on.

    2.whenever i add codes in the render(Graphics g) section the content disapears and comes back again! and if i add tranformation the content gets animated by it self!

    3.How can i use the touch screen and verify the cubes coordinate! so i can check the collision.
    1.You have to create the cubes randomly and then draw them on the desired position.Then you can let them keep on moving in the desired direction.In order to create the cubes you can either use the code or can take the images.To put them on screen in different timings you have to check the time of the last created and drawn cube,then after this newly created cube,you can put the desired time to draw the next cube.You have to use the System.currentTimeMillis(),please ignore the spell.

    2.Which content are you talking about?
    if you are talking about the cubes,the if the one had already disappear then how it come again,thats the code issue,you can take the boolean variable for the same,and set reset these variable.

    3.You would be drawing the cubes on some X params and Y params,then you must be having the actual positions for all the cubes,now you can easily know that where exactly you have clicked/touched the screen,is not it?
    SO using the x and y position of the cubes and the touch position on the screen you can detect the collision,

    I hope that these lines can help you in any means!!
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Re: m3g problem pls hel-p

    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

Similar Threads

  1. About 6230 Bt Problem
    By eerkek in forum Bluetooth Technology
    Replies: 17
    Last Post: 2005-02-08, 12:33
  2. M3G (JSR 184) Detail about External Reference in m3g file
    By amitian in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2004-12-28, 14:50
  3. Nokia Data Suite 4.05 Problem! HELP PLS!
    By adelelynch in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-05-20, 15:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×