@Joshuanoble,
I did try to use the screenToWorld to just get the shape drawn at the same place where it would have been drawn if there was no cam. I am not getting the results and here’s a short part of the code from what I am trying.
Consider this shape
(very crude code here, just wrote it down in the text box without IDE)
MyCustomShape class
class MyCustomShape : ofNode {
public:
MyCustomShape(camRef* camParam = NULL)
{
setPosition(400,50,0);
origin.set(0,0,0);
videoPlayer.width = 200;
videoPlayer.height = 100;
animationPlaying = false;
camRef = camParam;
//Load and play in video player
finalPosition.set(100,50,0); //final position when the shape (i.e. video player here) should be drawn as a full screen without any transformations (similar to what it would have done without ofEasyCam
}
void customDraw()
{
if(camUsed){
if(!animationPlaying){
//A changed orientation of video player in 3D
videoPlayer.draw(0,0,200,100);
lookAt(origin);
}
else if (animtionPlaying){
//Remove the orientation of the video player. It should be displayed like a simple rectangle drawn on the screen without camera
ofVec3f playerPos = camRef.screenToWorld(finalPosition);
//No look At, No rotations, No transformation required. Just plain display of video over the screen with the starting coordinate at finalPostion.x and finalPosition.y
videoPlayer.draw(playerPos.x, playerPos.y, 800, 600);
}
}
}
bool animationPlaying;
ofVec3f origin;
ofVideoPlayer videoPlayer;
ofVec3f finalPosition;
ofEasyCam* camRef;
};
**
testApp.h**
MyCustomShape* myShape;
ofEasyCam myCam;
testApp.cpp
void testApp::setup(){
myShape = new MyCustomShape(&myCam);
}
void testApp::draw(){
myCam.begin();
myShape.draw();
myCam.end();
}
void testApp::keyPressed(){
if(key==' '){
myShape->animationPlaying = true;
}
If I do the above, I was expecting the video to just come directly in the face of the user at the finalPosition (not rotated or transformed etc.). However, what I get is this:
animationPlaying flag = false;

animationPlaying flag = true;

Currently, MyCustomShape only has a boolean flag of playing/not playing. I am later going to change this to an enumeration of stopped, hover, playing, not playing, done etc. with different positions of MyCustomShape to be set then.
- The above finalPosition looks like still looking at the origin although in the (animationPlaying) if condition, I didn’t ask it to lookAt.
- The video position should have come somewhere top left + 100, top Left + 50 but the video is coming in the centre somewhere which I wasn’t expecting after screenToWorld
- If you notice, after applying the cam, all the drawn objects look inverted (the circle that you on the above video rectangle if actually topLeft, but after inverting appearing bottomLeft). Is there any way I correct this?
Without the EasyCam here, the video would have appeared at vertex (100, 50, 0) and not inverted, and that is the same thing I am trying to get when it’s inside the cam.