How do I do Object3D.rotate(SimpleVector)

Started by AGP, March 27, 2014, 03:40:47 AM

Previous topic - Next topic

AGP

Surely, the equivalent (I'm porting code from the old irrlicht engine) isn't:

someObject3D.rotateX(sv.x);
someObject3D.rotateY(sv.y);
someObject3D.rotateZ(sv.z);


Is it?

EgonOlsen

No idea. For that, i would have to know what the irrlicht method does.... ???

AGP

It goes like the following (whatever the equivalent irrlicht objects were):


nativeRotation.set(mesh.getRotation().x, mesh.getRotation().y + rotationY, mesh.getRotation().z);//nativeRotation WAS A vector3df (just a SimpleVector)
node.setRotation(nativeRotation);//NODE WAS SORT OF Object3D


The setRotation documentation:
http://irrlicht.sourceforge.net/docu/classirr_1_1scene_1_1_i_scene_node.html#adb6ff54f52d3a9e1514cd487a550935c

EgonOlsen

Judging from the sparse documentation, i would think that your port is correct (maybe with different signs depending on the coordinate system), but looking at the code, i totally don't get the +yrotation part. Are you sure that this code comes from the method that takes a vector3?

AGP

Yes. Why?

From what I gather, irrlicht's orientation is jpct's rotated PI around Y...

EgonOlsen

Quote from: AGP on March 27, 2014, 07:47:13 AM
Yes. Why?
Because i don't get it. Either add some stuff to all components or to none, but adding something to y only seems to make no sense when looking at it from the outside.

AGP

What do you mean? The way I see it, this code is producing a SimpleVector that holds an object's current rotation on all axis (and the object is currently only being rotated around y).

What do I do if I'm right about irrlicht's orientation? Is it still someObject3D.rotateX(sv.x), someObject3D.rotateY(sv.y), someObject3D.rotateZ(sv.z)?

EgonOlsen

Quote from: AGP on March 27, 2014, 08:27:59 AM
What do you mean?
I mean this: nativeRotation.set(mesh.getRotation().x, mesh.getRotation().y + rotationY, mesh.getRotation().z);

Apart from that, i really can't tell. In theory, your idea looks fine. It depends on how Irrlicht applies the rotations (i.e. in which order). I suggest to just try it and see what happens.

AGP

I know that's that to which you were referring; that's what I wrote about.

I'll go with my code for now, but I can't test it for a while: I'm working down from 1500 compilation errors across dozens of classes. I'm currently just under 1000 errors!

AGP

#9
Too often do I need to get a Texture's name with only the texture instance in this port. Could I either get a Texture.getName() or a TextureManager.getNameByInstance(Texture)? I realize that I could use getNameByID(Texture.getExternalID()), but in my experience getExternalID() isn't always filled.

AGP

Is that a "no" or is it your day job again? :- )

EgonOlsen

No, it's rather some strange concept called "sleep". Texture.getName() isn't possible, because a texture instance has no name. getExternalID() is something completely different and not suitable for this. TextureManager.getNameByInstance(Texture) sounds reasonable. I'll add it this evening.

AGP

It's very strange indeed. But I did post this during what must be your afternoon... Thanks very much, pal. Have you had a chance to read my e-mail?


AGP

I had to decompile to find out the name of the method. :- )

Thanks a lot.