Swap y and z axis?

Just to be sure - is there a way to get jME to swap the y and z axis? I’m working with data which is in that form, and it’s not as easy as swapping the axis at load time, because at times I need to display coordinates to the user and it needs to be in the original (non-jME coordinates) format.



I could have sworn I saw some setting or something that sounded like it did this, but it may have been jme2 docs or whatever.

could you tell more why you can’t swap it after loaded asset? :slight_smile:

cant you swap it after loaded?

[java]

Vector3f vect = new Vector3f(x,z,y);

[/java]

and rotate ?



if this is what i think you could also use:



[java]

rootNode.rotateUpTo(vectorUp);

[/java]



“I need to display coordinates to the user and it needs to be in the original (non-jME coordinates) format”



cant you just display in swapped order? “x z y”?



i just dont know in what is problem, so if you could tell more it would be great :slight_smile:

I can, and was starting to do this, but it actually results in just as many complications since my UI needs to show the original x,y,z coordinates–but I’d have to remember to swap y/z each time in the UI as well as during loading/saving.



I’ll probably just have to deal with it, because I can’t recall any engine that actually can, but if there’s some simple configurable solution it’d be easier by a long shot.



Edit - ugh, just remembered I’ve been inverting the y axis after the swap as well. I think working with 3rd party mesh data that I can’t convert to a jME friendly format is probably just a headache I’ll have to deal with.

maybe you should start write AssetEventListener that will change data before loading

[java] AssetEventListener nnn = new AssetEventListener() {

public void assetLoaded(AssetKey key) {

throw new UnsupportedOperationException(“Not supported yet.”);

}

public void assetRequested(AssetKey key) {

key.

throw new UnsupportedOperationException(“Not supported yet.”);

}

}

assetManager.setAssetEventListener(nnn);[/java]

but it is my first stupid idea ;p

i dont know solution to change “core” location order, but as you said i think you should “deal with it” (becouse as i looked for this too - i dont find) :slight_smile:

Edit: I dont know what program do you use for your assets. But in Blender you can swap data

Sounds like you might be rotating instead of swapping. A straight y,z swap can’t be represented with a rotation but if you are also flipping the sign of Y then you might be doing a 90 degree rotation around the X axis.



And while that’s still a little tedious, it can at least sometime just be something that gets factored into your loading as a setLocalRotation()…depending on how your object hierarchy looks. Or you could just do that to the root node and not worry about it anymore.

Hmm, come to think of it yes I forgot I’m rotating 90 degrees too. That’s an idea, rotating the root node, for some reason it hadn’t even occurred to me. That’ll simplify things a bit… I just need to be careful how I refactor this since I have a working application now, no good in breaking it trying to clean it up.