[JME3] Beginner help – retrieving Bounding Box of a spatial --Canceled

Hello,

First post on this group !

I’ve adjusted my project to use jMonkeyEngine3. ( I started the project with JAVA3D )



I need to retrieve the bouding box of a loaded spatial :

[java]

public void setBattleground( String fileName, float width, float depth )

{

battlegroundNode = ViewManager.getAssetManager().loadModel( fileName );

BoundingBox box = (BoundingBox) backgroundNode.getWorldBound();

[/java]



I tried the method getWorldBound() but it doesn’t seem to return what I want.

In fact I need to resize my model



[java]

float currentWidth = box.getXExtent();

float currentDepth = box.getZExtent();

float currentHeight= box.getYExtent();



//scale

float xcoeff = width / currentWidth;

float zcoeff = depth / currentDepth;

float ycoeff = ( xcoeff + zcoeff ) / 2.0f;

battlegroundNode.scale( xcoeff, ycoeff, ycoeff );

[/java]



The model is correctly resized but :

[java]

//update

battlegroundNode.updateGeometricState();

box = (BoundingBox) backgroundNode.getWorldBound();

currentWidth = box.getXExtent();

currentDepth = box.getZExtent();

currentHeight= box.getYExtent();

System.out.println( "Scene width : " + String.valueOf( currentWidth ) );

System.out.println( "Scene depth : " + String.valueOf( currentDepth ) );

[/java]



The worldBound hasn’t changed.



–>My questions are :