Ofximgui How to add ImGuizmo?

BTW I am always using GitHub - Daandelange/ofxImGui at develop instead of GitHub - jvcleave/ofxImGui: Use ImGui in openFrameworks.

But the Guizmo should be at the center of the ofNode, no?
Because, the handles are working, my problem is that there is an offset between the Guizmo position and the actual center (pivot point) of the Node/Object

Like, this is what I’m expecting. But in your video the Guizmo is not in the center of the Node, even if you switch between local and global mode, it won’t work properly.

@moebiussurfing This is my first attempt on using C++ and OF and I have used ofxGuizmo and as you can see, the guizmo is placed at the origin of the object. This time, I wanted to use ofxImGuizmo because it has more information and better UX then ofxGuizmo

Ah ok, sorry, now I see.
I misunderstood that the offset was an “expected feature”. I don’t used much gizmos before…

Maybe you could use the OF native addon (ofxGuizmo) for the moment.

But if you are using ImGui too for the rest of your gui, then:
Maybe you can try to fix that offset of the ofxImGuizmo addon.
It seems that the addon makes the camera and ofNode conversions with helpers, from/to “raw cpp” and OF.

I’ll try to make ofxImGuizmo work and i’ll make an issue to (ping) @nariakiiwatani’s repo in GitHub.

If you are interested to test, I just made a WIP example porting the raw CedricGuillemet/ImGuizmo.
BUT: Note that all the helper transforms/perspective camera are not added yet, is not using the OF classes: just “raw cpp”.

1 Like


Man, thank you so much!! :face_holding_back_tears:
I will try to integrate it in my project.
I hope everything works well :sweat_smile:

Np, you are welcome,
but note that depending of what you need, you will be limited,
bc you can’t use some OF classes like the camera/ofNode stuff.
Maybe getting some stuff from ofxImGuizmo, or just fixing the transforms would be cool.

Yes, I will try to do that. But for now, just getting the Position, Rotation and Scale of the Guizmo should do the job.
Can you tell me if I can set (define) the position of the guizmo? Like, can I pass an OfNode position (it can also be a Vec3f value)?
Because I want to be able to select different object in the scene

there are 4 hardcoded objects/gizmos in the scene.

static float objectMatrix[4][16] = {

each object is a 4x4 matrix that handles pos/rot/scale.

that’s the point of creating helpers to use ofNode class easily…

Same for the camera:

    float cameraView[16] =
    { 1.f, 0.f, 0.f, 0.f,
      0.f, 1.f, 0.f, 0.f,
      0.f, 0.f, 1.f, 0.f,
      0.f, 0.f, 0.f, 1.f };

    float cameraProjection[16];

Hey @luk3d ,
I found a fix for ofxImGuizmo.

I added also new helpers that allow to use ofNode and ofCamera classes directly.


		// Applies the node's transformation matrix

    // Draws the ImGui gizmo editor passing modes.
    // Out of an ImGui window. Can be used directly into an OF viewport / camera.
	ImGuizmo::drawImGuizmo(&gui_, &cam_, &node_, op_, mode_);
1 Like

Thanks a lot man!
It’s now working fine. :blush:
Now, I will try to port this other cool addon to learn how to implement a new ofAddon.
I think that someone beside me, will have a need for something like this.

fknfilewalker/imoguizmo: Interactive Orientation Guizmo for ImGui (github.com)


Thanks one more time for your help!

1 Like