-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add an object in the scenario #35
Comments
by "object" do you mean UIKit element or OpenGL geometry? or something else? |
Ideally an UIKit element (I am not familiar with OpenGL ), in my scenario I want to add a .PNG image of a satellite object at a "real world position" , I am not sure what kind of object I will need. |
right.. so, the problem isn't solved for UIKit elements. you saw from issue 19 that you can update the element's x,y position using that getScreenLocation... function? but that the object doesn't rotate with the scene. what's missing is some kind of function that's like rotationValue for Screen Location. were you trying to solve the rotation problem? or thinking of a different approach? |
You mean rotation by the itself rotation? Or in the 3d environment? I am not sure what I need to do to achieve this behaviour (again, I am not familiar with OpenGL). |
again, this is not a good solution. UIKit integration isn't seamless at this point. step 1 is this function:
you have the altitude and azimuth, convert that to a vector, and then set your UIKit element's position to the CGPoint returned. but you'll notice that your UIKit element doesn't rotate if you rotate your screen around the Z axis (the normal through the screen). doing this would be step 2 is this the direction you are aiming for? |
:/ I need the Z axis to give the user the "point to a satellite" feature. This step 2 to get the Z axis is too complicated using UIKit? |
i'm not good enough at 3D math to anticipate wether or not step2 would be an easy problem to solve. it might be easy.. |
So I should start setting the UIKit element and setting its position to |
the position won't be incorrect. you should do what you're suggesting. you'll see what i'm talking about. it's only the rotation of the object that will be incorrect. the position should be fine. |
Ty very much for the support, I will try to implement it. |
Probably there is a smarter way of doing this, buuuut it kind of worked. At initOpenGL
At updateLook
There is another question, Why it kind of create 2 objects...? there is some way of solving this? |
oh great! i think you uncovered a bug in |
what you did is fine but i would alloc UIKit things inside of ViewController instead of PanoramaView, place the button updating code in |
little trick, and we have one button :D -(void) glkView:(GLKView *)view drawInRect:(CGRect)rect {
[panoramaView draw];
GLKVector3 position = GLKVector3Make(0.0000001, -0.04, 0.1);
CGPoint buttonLocation = [panoramaView screenLocationFromVector:position];
CGPoint p = [panoramaView imagePixelAtScreenLocation:buttonLocation];
if (round(p.x) != 512) return;
if (buttonLocation.x == buttonLocation.x) {
[button setFrame:CGRectMake(buttonLocation.x, buttonLocation.y, 40, 40)];
}
} |
@Allui |
Hey @Allui, @UlyssesRocha, did any of you manage to show only one button over there? I am not sure how to do it but I guess the screenLocationFromVector method might have more than one solution. Am I right? |
Hi,
I saw at issue 19, a way of add a button in the screen, outside the VR scenario.
But, Its possible to add an object at a relative position inside the VR image?
Set an image to represent an Object at a relative position (altitude and azimute) , to be render with the background image?
The text was updated successfully, but these errors were encountered: