Collision only triggered when player is at Vector3f(0, 0, 0)

Hello, I am new to Jmonkey, trying to making a simple game to detect 2 box’s collision, the 1st box is controlled by player with a default location Vector3f(0, 0, 0), the other one is placed in Vector3f(7, 1, 7). I also created a BoundingBox at Vector3f(7, 1, 7) for the 2nd box.
But collision seems always triggered when player at Vector3f(0, 0, 0)
here is my code:

import java.util.ArrayList;
import com.jme3.asset.TextureKey;
import com.jme3.asset.plugins.FileLocator;
import com.jme3.bounding.BoundingBox;
import com.jme3.collision.CollisionResult;
import com.jme3.collision.CollisionResults;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode;
import com.jme3.input.ChaseCamera;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.AnalogListener;
import com.jme3.input.controls.KeyTrigger;

public class geme_test_coll extends SimpleApplication {

    public static void main(String[] args){
    	geme_test_coll app = new geme_test_coll();
    BoundingBox pillerBounding = new BoundingBox();
    Geometry player;
    ChaseCamera chaseCam;
    BoundingBox playerBounding = new BoundingBox();
    Geometry g = new Geometry();
    SecureRandom sr = new SecureRandom();
    public void simpleInitApp() {

      assetManager.registerLocator("town", FileLocator.class);
      Box box1 = new Box(0.5f, 0.5f, 0.5f);
      player = new Geometry("player", box1);
      player.setLocalTranslation(new Vector3f(0, 0, 0));
      Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      mat1.setColor("Color", ColorRGBA.Green);




      chaseCam = new ChaseCamera(cam, player);

      Box floor = new Box(100, 0.1f, 100);
      Geometry floor_geo = new Geometry("floor", floor);
      Material floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      TextureKey tk = new TextureKey("metal-tiles-dirt.jpg");
      Texture floor_tx = assetManager.loadTexture(tk);
      floor_mat.setTexture("ColorMap", floor_tx);
      floor_geo.setLocalTranslation(0, -0.1f, 0);

      floor.scaleTextureCoordinates(new Vector2f(100f, 100f));

      int rnd = sr.nextInt(4);
      Box piller = new Box(0.5f, 1 + rnd, 0.5f);
      g = new Geometry("piller", piller);
      Material m = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      m.setColor("Color", ColorRGBA.randomColor());
      g.setLocalTranslation(new Vector3f(7, 1, 7));

      pillerBounding = new BoundingBox(new Vector3f(7, 1, 7), 0.5f, 1 + rnd, 0.5f);


    private void movementManager() {
    	inputManager.addMapping("M_L", new KeyTrigger(KeyInput.KEY_W));
    	inputManager.addMapping("M_R", new KeyTrigger(KeyInput.KEY_S));
    	inputManager.addMapping("M_F", new KeyTrigger(KeyInput.KEY_A));
    	inputManager.addMapping("M_B", new KeyTrigger(KeyInput.KEY_D));
    	inputManager.addMapping("ROT", new KeyTrigger(KeyInput.KEY_R));
    	inputManager.addListener(al, "M_L", "M_R", "M_F", "M_B", "ROT");
    private AnalogListener al = new AnalogListener() {
    	public void onAnalog(String cmd, float value, float tpf) {
    		Vector3f playerPosition = player.getLocalTranslation();
    		float spd = (float)((float)speed * 4);
    		if(cmd.equals("M_L")) { player.setLocalTranslation(playerPosition.x - value * spd, playerPosition.y, playerPosition.z); }
    		if(cmd.equals("M_R")) { player.setLocalTranslation(playerPosition.x + value * spd, playerPosition.y, playerPosition.z); }
    		if(cmd.equals("M_F")) { player.setLocalTranslation(playerPosition.x, playerPosition.y, playerPosition.z + value * spd); }
    		if(cmd.equals("M_B")) { player.setLocalTranslation(playerPosition.x, playerPosition.y, playerPosition.z - value * spd); }
    		if(cmd.equals("ROT")) { player.rotate(0, 0 + value * spd, 0); }
    private void collisionDetect() {
    	Geometry a = player;
    	BoundingBox b = pillerBounding;
    	CollisionResults results = new CollisionResults();
    	a.collideWith(b, results);
    	System.out.println("Number of Collisions between" +
    	a.getName()+ " and piller " + results.size());

    	if (results.size() > 0) {
        CollisionResult closest  = results.getClosestCollision();
        System.out.println("What was hit? " + closest.getGeometry().getName() );
        System.out.println("Where was it hit? " + closest.getContactPoint() );
        System.out.println("Distance? " + closest.getDistance() );

Output when player is at <0, 0, 0>

Number of Collisions between player and piller 10
What was hit? player
Where was it hit? null
Distance? 0.0
the Number has a range about from 6 to 10

Output when player is outside <0, 0, 0>

Number of Collisions between player and piller 0

can anyone help me? thanks!

Step 1 of any debugging: verify assumptions.

I think if you actually log the world bound output of your spatials you will be very surprised.

For example, this code is effectively nonsense:

In english, it says:
set a custom model bounds
recalculate and override the custom model bounds

…which is more or less meaningless in this case since you are just setting the bounds to what already would have been calculated. (Good thing, too, because otherwise your pillerBounding (sic) would be at (14, 2, 14) instead of the (7, 1, 7) that you want. Model bounds is always relative to the spatial’s origin.

If you want the world bounds of the “piller” (sic) just ask for it.

Random things I see that are just off but not related to your problem:

…never really used for anything. Might as well not have it.

Unnecessary. Not meant to be called by users. Should never do it.

The real way to figure out your problem and/or to get help would be to put some System.out.println() calls in collisionDetect() to verify that the player world bounds is what you expect… and the world bounds of the pillar.

But I think the real issue is that you call geom.collideWith(boundingBox) and expect it to return scene graph elements. It was never provided with anything but a bounding box. The only thing it can return is player… since that’s the only part of the scene that it knows about. I’m still surprised by that, too.

But to be honest, I’m not sure what you are trying to do anymore.

Thakns for the help, honestly, I am kinda missed up a bit for what I am doing too.
To simplefy what I am trying to do is that player controls 1st box and there’s a second box, if player hits the second box, there will be some interactive stuff.
But I have no idea how to determine if the player hits the second box. I have followed this doc but still no idea why it is not working…