Objects & OBB [Dev help required]

Hi , I'm opening a post on a problem that i've posted before , pnly this time i think I need a DEV help (thanks for Mindgamer fot the advice).

the problem is really simple , when I wrap some objects (qouds or Box etc') with an OBB and I rotate this objects , the OBB that is being formed , is being formed wrong , some of the objects can result of being half inside the OBB and half outside , so in some angles the view is passing the OBB but not ht eObject and thus the object disapears.

I've wrote a sample code with the simple game , when you run this code and press B to see the OBB you've notice that some qouds are half in and half out , so you can spin the camera a little to the left to see how the object disapeas before it sould.


import com.jme.app.SimpleGame;
import com.jme.bounding.OrientedBoundingBox;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jme.scene.SharedMesh;
import com.jme.scene.shape.Quad;


public class Test extends SimpleGame{

/**
* @param args
*/

public static void main(String[] args) {
Test t = new Test();
t.setDialogBehaviour(SimpleGame.NEVER_SHOW_PROPS_DIALOG);
t.start();

}

protected void simpleInitGame() {

//
Creating the nodes
Node hall = new Node("Hall");
Node store = new Node("store");
Node rightWindow = new Node("rightWindow");
Node leftWindow = new Node("leftWindow");
Node wall = new Node("Wall");
       
//
Creating objects
// Init Base Mesh for quad
Quad quadBaseMesh ;
quadBaseMesh = new Quad("quadBaseMesh");
quadBaseMesh.initialize(1, 1);
quadBaseMesh.setLocalTranslation(.5f, .5f, 0.5f);
quadBaseMesh.setModelBound(new OrientedBoundingBox());
quadBaseMesh.updateModelBound();

hall.attachChild(store);
store.attachChild(wall);
store.attachChild(leftWindow);
store.attachChild(rightWindow);

//
  right window
SharedMesh qRightWindow = new SharedMesh("qRightWindow",quadBaseMesh);
qRightWindow.setModelBound(new OrientedBoundingBox());
qRightWindow.updateModelBound();
rightWindow.attachChild(qRightWindow);
// Transformations
rightWindow.setLocalTranslation(new Vector3f(183,0,156));
rightWindow.setLocalScale(new Vector3f(75,45,1));
float angle =45;
Vector3f rotateVector = new Vector3f(0,1,0);
Quaternion quaternion = new Quaternion();
quaternion.fromAngleAxis(angle*FastMath.DEG_TO_RAD , rotateVector );
rightWindow.setLocalRotation(quaternion);

//
left window
SharedMesh qleftWindow = new SharedMesh("qLeftWindow",quadBaseMesh);
qleftWindow.setModelBound(new OrientedBoundingBox());
qleftWindow.updateModelBound();
leftWindow.attachChild(qleftWindow);
// Transformations
leftWindow.setLocalTranslation(new Vector3f(103,0,236));
leftWindow.setLocalScale(new Vector3f(75,45,1));
angle =45;
rotateVector = new Vector3f(0,1,0);
quaternion = new Quaternion();
quaternion.fromAngleAxis(angle*FastMath.DEG_TO_RAD , rotateVector );
leftWindow.setLocalRotation(quaternion);

//
wall
SharedMesh qwall = new SharedMesh("qwall",quadBaseMesh);
qwall.setModelBound(new OrientedBoundingBox());
qwall.updateModelBound();
wall.attachChild(qwall);
// Transformations
wall.setLocalTranslation(new Vector3f(240,0,0));
wall.setLocalScale(new Vector3f(95,100,1));
angle =-90;
rotateVector = new Vector3f(0,1,0);
quaternion = new Quaternion();
quaternion.fromAngleAxis(angle*FastMath.DEG_TO_RAD , rotateVector );
wall.setLocalRotation(quaternion);


cam.setLocation(new Vector3f(200,5,350));
        rootNode.attachChild(hall);               
}
}


please can anyone help figuring out this problem ?
thanks

I'll have a look.  This bug has bothered me in the past as well…  :slight_smile:

Fixed and patched in svn.  Turns out there was an improper use of calculated axis data during the merge process.

1 Like

20 min …  hehe  nice work

renanse said:

Fixed and patched in svn.  Turns out there was an improper use of calculated axis data during the merge process.

I salute you my friend :)
Thanks for the help
Moshe

where do I find the SVN to download from ?

The SVN for jME 2.0 can be found on google-code:

http://code.google.com/p/jmonkeyengine/source/checkout



Or you can just enter in your favourite SVN client the URL:

http://jmonkeyengine.googlecode.com/svn/trunk/

1 Like

Thanks  :smiley: