Detect and Remove Model / Object Collision

I am new at using Jmonkey so i have a problem. When i load two models, one hand of a model goes into the other. What and how can i do to avoid this collision? Like when i load it for the first time i want if the models are colliding they should move a little to the side where they are not colliding.

Here is my code

Spatial plant = assetManager.loadModel(“try4/low.obj”);
plant.setLocalTranslation(new Vector3f(100,0,0));

  	BoundingVolume volume  = plant.getWorldBound();
  	Vector3f extent = ((BoundingBox)volume).getExtent(null);
  	float q = (extent.x);
  	float w = (extent.y);
  	float e = (extent.z);
  	float a,b,c;
  	a = -100+q;
  	b = 0;
  	c = e+0.1f;
  	Quaternion roll = new Quaternion();
  	roll.fromAngleAxis(FastMath.PI/2, new Vector3f(0,1,0));


   	Spatial plant2 = assetManager.loadModel("try3/Anakin.obj");
  	plant2.setLocalTranslation(new Vector3f(100,0,0));

// RigidBodyControl r2= new RigidBodyControl(0.0f);
// plant2.addControl(r2);
// physics.getPhysicsSpace().add(r2);

  	Quaternion roll2 = new Quaternion();
  	roll2.fromAngleAxis(FastMath.PI*7/4, new Vector3f(0,1,0));

I know the i have fixed the coordinates of both the models to collide but i want to see if they collide one model should move to the side so they dont

one hand of a model goes into the other

What do you mean by that ? Do you want it to be collidible or not ?
If you want to merge the models as one model in Jm3, you can do it on the scene management.

I think he wants objects placed to automatically move apart if they are colliding?

Non physics-bullet way of doing it via bounding volumes
Under bounding volumes - I’m pretty sure your model will already have one… I think you have to cast it to a Geometry to get it, then you can do getModelBound()

Then you can use the BoundVolume’s method: intersects(BoundingVolume bv) with your other models boundingvolume
to find if they intersect. If they do well uh… you can get some info from the bounding volume to decide what to do and then just move them.

Not sure if you want to use proper physics, I just normally don’t place objects inside each other, and make sure the control uses a shape larger than the model itself.

@JESTERRRRRR is right when i want that. If the models are colliding i want that they should automatically should move apart from each other @wagfeliz

With physics you really don’t want them starting inside each other as it won’t automatically resolve that (as far as I know). So I’d suggest what I said before, or just make sure they start apart, cos once they’ve been placed separately the physics controls should stop them if they move into each other.

@JESTERRRRRR Thanks for the help