Another problem with model from OgreMax

I have got problem with model after I canverted it from .max file with Ogremax.
Situation similar with another model, but little bit different.

I use OgreMax to export .scene from .max file.

Code of boby

Spatial zilNode = assetManager.loadModel(ZIL_SCENE_LOCATION);
Texture tex = assetManager.loadTexture(ZIL_TEXTURE);
mat.setTexture(“ColorMap”, tex);
zilNode.setMaterial(mat);
zilNode.setShadowMode(ShadowMode.Cast);
CollisionShape carHull = CollisionShapeFactory.createDynamicMeshShape(zilNode);
vehicleControl = new VehicleControl(carHull, vehicleWeight);
zilNode.addControl(vehicleControl);
rootNode.attachChild(zilNode);
bulletAppState.getPhysicsSpace().add(vehicleControl);

adding wheels:

Geometry wheel = findGeom(node, nameOfPart);
wheel.setLocalRotation(new Quaternion().fromAngleAxis((float)Math.toRadians(180), new Vector3f(0, 1, 0)));
wheel.center();
BoundingBox box = (BoundingBox) wheel.getModelBound();
radius = box.getYExtent();
vehicleControl.addWheel(wheel.getParent(),box.getCenter().add(x, -1.8f, z), wheelDirection, wheelAxle, 0.2f, radius, isFrontWheel);

everything seems to be fine, but when i turn on debugShape (setDebugEnabled(true); , I’ve noticed somethig weird

3 right wheels was in 2 places (i think it’s they physic location and Node location, mayby I’m wrong)

Can anyone help me?
Thank you

p.s. I found than not right wheels is shifting. left shifting too, they just situated on the places of right.
and if i move conection point, then wheels visualy shifted

To be honest, I can’t really solve your problem, but maybe I can come up with another possible solution (not sure). If the wheel and the vehicle are seperate models, you could try to define nodes in the vehicle model (wheel1, wheel2, …) and attach the wheels itself to that nodes. Every time you create a wheel object you add a control which gives the wheel physics (RigidBodyControl or whatever). Hopefully I could help you, if not please tell me.

thank you for reply,
but i think i’m found my problem (but not solution)
when i load model after OgreMax export it’s look like this

wheels shifted, and situated in one place.
Maybe there is another convertor than Ogre, or i miss somethitg in exporting process?
thank you

what about xbuf importing way? I had some quite good results with it in the last few days

You however need to somehow get it to blender first.

Not sure but I think you may need to Apply Transform.
If you are using 3DS Max you may watch this video [from minute 5:0 ] hope it help

or

I’ve tried to reset params, video - it doesnt’n work properly
So i decided to move every part manually after export using OgreMax.

  • change position of whhels in .scene file, so jme can mace properly CollisionShape
  • than move every wheel to it’s position

private void addOneWheel(Spatial node, String nameOfPart, Vector3f move, Vector3f addToCenter, Boolean isFrontWheel){
Geometry wheel = findGeom(node, nameOfPart);
wheel.setLocalRotation(new Quaternion().fromAngleAxis((float)Math.toRadians(180), new Vector3f(0, -1, 0)));

wheel.move(move);

BoundingBox box = (BoundingBox) wheel.getModelBound();

  radius = box.getYExtent();
  vehicleControl.addWheel(wheel.getParent(),box.getCenter().add(addToCenter), wheelDirection, wheelAxle, 0.2f, radius, isFrontWheel);

}

When my model is kinematic, then everything fine, but if I set mass or disable kinematic with wheels happens something weird

kinematic = true:

kinematic = false:

any suggestions?
thank you

When you export from 3dmax the origin/center of the wheel node has to be at the center of the wheel mesh, in blender we have “Origin to center of mass” that does this, i have no idea how to do it in 3dmax though.

So, after many manipulations in 3dMax before export, it seems to work
more or less normal:

  • I set rotate to wheels (0,0,0)
  • move wheels to height = 0
  • move body forvard

Result

maybe it helps someone