ofEasyCam revert matrix

Hi everybody,

I am struggling with the following problem.

How can I have coordinates that are drawn within ofeasycam stay in their original position even when I move the camera.

Let me try to explain.

Let’s say i have a point in space at 100,0,0 that is drawn with ofeasycam (with autodistance on).
When I then move the camera like this
cam.setGlobalPosition(-100,0,0);
cam.lookAt(0,-100,);

I want my point at 100,0,0 to stay where it was.

I have tried a lot of stuff like:
mypoint = mypoint*cam.getGlobalTransFormatrix.getInverse();

But working with the ofeasycam getGlobalTransform and/or getModelViewMatrix does not seem to do the trick…
Maybe my orderis wrong but I can’t seem to figure this out…

Thank you so much for your help.

Should not simply work with myPoint.getGlobalPosition() ? changing the position of the camera does not change the word coordinate of the point.

Thanks for replying!

The problem is when you set the position of the camera and the lookat it changes a bunch of things in the background.

When I have a point that is at pos 100,0,0 fi and I draw it within a camera that is moved with position and lookat, I actually can’t seem to get the new coordinate of the point.

What I need to do is project coordinates from one space into a second space.

In this second space there are already a bunch of points that are affected by the camera pos/lookat but I need the new points not affected by the camera matrix but in the same camera space so I can use the new points as attractors for a particle system made up by the old points.

So for instance I have two points:

pointa = ofVec3f(100,0,0);

now point b is in a camera space like this:
cam.setPosition(-399,464,8);
cam.lookAt(0,40,0);

cam.begin();
pointb.draw(300,400,200);
cam.end();

now point b is at this point rotated, moved and scaled.
I have no idea of what it’s actual coordinates are once it has been drawn by the camera.

Now if I throw pointa also in there, it gets rotated moved and scaled as well.
But I want point a in the camera space at its true position 100,0,0 not rotated, scaled and translated but still in the camera space so that I can animate point b to it in the same camera space.

Maybe I am overthinking this :slight_smile: