Android axis and .wav file

Hi everyone,



This is my first post ever, and after all I would like to thank the efforts of the jmonkey team and community. I have learned a lot following your tutorials and forum discussions.



Now to the point: I´m on a personal project of a tetris like game, and up to this moment it runs in my Desktop as I do expect, but when I test the game in my android phone (LG Optimus L3) I have a problem. The collision checking (made with rays) doesn´t work, it looks like the axis have changed, and then any world values I have entered are no longer valid.



Any idea about where should I start looking for solutions?

Can you show the code that seems to result in inverted values or ideally make a test case for this?

Hi Normen, thank you for your soon reply. After posting, I reduced the size of the image i use as a texture surrounding an sphere (for simulating a rotating sky with stars), and then the collisions where good. The fact is that the collision checking is on a controlUpdate method of a movement control I use for moving the spatials, and stoping them when they reach a cube at the center of the screen. Maybe when loading the big image I do mention above, the controlUpdate method was faster than the scene load, so when the scene finished to load, my spatials were already far away of where they were supposed to collide.



This is the code of the control:



package mygame;



import com.jme3.collision.CollisionResult;

import com.jme3.collision.CollisionResults;

import com.jme3.math.Ray;

import com.jme3.math.Vector3f;

import com.jme3.scene.control.AbstractControl;

import com.jme3.scene.Node;

import com.jme3.renderer.RenderManager;

import com.jme3.renderer.ViewPort;

import com.jme3.scene.Spatial;

import com.jme3.scene.control.Control;



/**

*

  • @author rodney

    /

    public class MyMovementControl extends AbstractControl {



    int x, y,z;

    boolean located, same;

    Node[] faceArray;



    public MyMovementControl(int x, int y, int z, boolean located, Node[] faceArray){

    this.x=x;

    this.y=y;

    this.z=z;

    this.located = located;

    this.faceArray = faceArray;

    }



    @Override

    protected void controlUpdate(float tpf){

    if(spatial != null) {



    for(int i=0;i0){



    CollisionResult farthest = results.getFarthestCollision();

    Vector3f contact_point = farthest.getContactPoint();

    CollisionResults results2 = new CollisionResults();

    Ray ray2 = new Ray(contact_point,ray.direction);

    spatial.collideWith(ray2, results2);

    if(results2.size()>0){

    CollisionResult closest = results2.getClosestCollision();

    if(closest.getDistance()<=1){



    located=true;



    Vector3f newLocalTranslation = faceArray.worldToLocal(spatial.getWorldTranslation(), null);

    spatial.setLocalTranslation(newLocalTranslation);



    faceArray.attachChild(spatial);



    this.setEnabled(!enabled); //here should end the life of the control

    }

    }

    }

    }



    if(!located){

    if(x!=0){

    spatial.move(-2f
    tpf, 0, 0);

    }else if(y!=0){

    spatial.move(0, -2tpf, 0);

    }else if(z!=0){

    spatial.move(0, 0, -2
    tpf);

    }

    else{ }

    }



    }



    }



    public boolean getLocated(){

    return located;

    }



    @Override

    protected void controlRender(RenderManager rm, ViewPort vp) {



    }



    public Control cloneForSpatial(Spatial spatial) {

    final MyMovementControl control = new MyMovementControl(x,y,z,located,faceArray);

    control.setSpatial(spatial);

    return control;

    }



    }