Blender model rotation[SOLVED]

Hi all,



I’m importing a model from blender in my game. The model always loads in horizontally, when I was testing the animation last week, i hadn’t any problem rotating the model. I just used model.rotate(-1.5f, 0.0f, 0.0f);



But now I want to really move around with the character and I have set a capsuleColisionShape on the character, but it seems I ain’t able to access rotate anymore, I have searched for 2 days now :s but just can’t find how to rotate the character.



[java]

private void createCharacter() {

CapsuleCollisionShape capsule = new CapsuleCollisionShape(1.5f, 2f);

character = new CharacterControl(capsule, 0.01f);

model = (Node) gamePointer.getAssetManager().loadModel(“Models/CBoy/cubeboyMesh.mesh.xml”);

model.setLocalScale(2.5f);

model.addControl(character);

model.getControl(CharacterControl.class).setPhysicsLocation(new Vector3f(0, 30, 0));

//model.getControl(CharacterControl.class).setPhysicsRotation(new Vector3f(-1.5f, 0.0f, 0.0f));

gamePointer.getRootNode().attachChild(model);

gamePointer.bulletAppState.getPhysicsSpace().add(character);

}

[/java]



//model.getControl(CharacterControl.class).setPhysicsRotation(new Vector3f(-1.5f, 0.0f, 0.0f));

This should work? no? but when I want to use the code it says “cannot find symbol” on setPhysicsRotation



Anyone knows what I’m doing wrong here?



Thx in advance

In blender, make sure any transformation (move, scale, rotate) is done in “Edit” mode, as opposed to “Object” mode to ensure they are applied when exporting it.

this is how my model looks in the blender edit mode window, it stands up or am I viewing it wrong?





also as I mentioned before, when I was testing the animation, I was able to rotate the character, here’s the code i used for that



[java]

private void initPlayer(){

player = (Node) gamePointer.getAssetManager().loadModel(“Models/CBoy/cubeboyMesh.mesh.xml”);

player.rotate(-1.5f, 0.0f, 0.0f);

player.setLocalScale(0.5f);

gamePointer.getRootNode().attachChild(player);



control = player.getControl(AnimControl.class);

control.addListener(this);

channel = control.createChannel();

channel.setAnim(“Stand”);

}

[/java]



how does this come? Is it because of the collisionShape?

Make sure to select “Convert to Y Up” in the OgreXML exporter

Start Blender

Open your file

Ctrl+A

Apply model rotation to objdata

Ogre exporter

Flip up axis to Y

1 Like

Thx Momoke and Kidneytrader! it worked :smiley: