Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - deqleos

#1
Support / Re: 3D objects offset
April 18, 2018, 11:08:07 AM
Yes that is exactly the issue, I've decided to keep the z at a fixed index and simulate object coming closer and further by scaling the 3d object. It has a decent visual experience.
Thanks a lot for helping!
#2
Support / Re: 3D objects offset
April 17, 2018, 03:16:01 PM
Hmm, it doesn't seem to change anything.
Don't think there is something wrong with the code I used, just to be sure:

model.build();
SimpleVector center = model.getCenter();
model.translate(-center.x, -center.y, -center.z);
model.translateMesh();
model.clearTranslation();
world.addObject(model);

I'll look a little more into the theory behind 3d. Very new to this.
I can manage to get unnoticeable offset by using a huge model and a very far z index, which is okay for now I guess.
#3
Support / Re: 3D objects offset
April 17, 2018, 09:58:07 AM
.getCenter() returns this: (-3.552497,1.6156462,-6.28337).
I guess your thought is then correct otherwise it would be (0,0)?
When I use a library model(primitives.getCube), .getCenter() returns (-1.4901161E-8,0.0,-1.4901161E-8). With this model the visual offset I get is a little less.
Do I manually have to manipulate the object center in different software (like Meshlab) ?
#4
Support / Re: 3D objects offset
April 16, 2018, 10:08:48 AM
Are there any other common causes? I don't have any bars on screen, just the camera preview.

EDIT: When debugging the reprojected object from 2d to 3d, I found out that projecting it back to 2d gives correct coordinates. I guess it's safe to assume the coordinates form screen match the framebuffer ones. Could my 3d model be the reason for this problem?

Edit2: See picture for what actually happens with the 3d object's position. In code I set it to be at the top left of the light grey square.
When the face moves closer, the 3d object moves more to the left of the set position, when the face moves further, the 3d objects moves more to the right of the set position.
#5
Support / 3D objects offset
April 12, 2018, 11:45:05 AM
Hi,

I have a question regarding a weird offset I get with 3D objects.
I receive a camera preview with faces on it. I want to show 3d objects on these faces, think about masks etc.
What I do is get the position of the face on the 2d preview and translate it to the 3d space with Interact2D.reproject2D3DWS().
I get a very weird offset though, where i can't seem to get the 3d object on the position that I want it to be. For example, I have the top left coordinates of the face but the 3d object will appear significantly to the left side.

What would the ideal circumstances be for a 2dto3d translation, in terms of the z axes, 3d model itself etc.

EDIT: I'm kinda confused now how reproject2dto3dWS() works now. If i put the object at x, y=100, the object barely moves on the x axis on screen and is like halfway they axis.

EDIT2: The idea that I want to implement is very simple but I'm having a really hard time with it. See the image for a simple illustration.
I have the face's positions and just want to overlay it with a 3d model.
The code that should give me the correct world space position is:
SimpleVector simpleVector = Interact2D.reproject2D3DWS(world.getCamera(), GLFrameBuffer, (int) faceRect.tl().x, (int) faceRect.tl().y, 20);



#6
Yeah, that's what I do now as well.
#7
I guess the issue is that onSurfaceCreated gets called and a new world gets initialised.
The 3D objects stay in memory for some reason and then I'm trying to delete them from the new world, which obviously won't work.
So the reason I asked for a way to delete individual objects is that I lose reference to the original world.

Anyways, the issue is pretty insignificant for now and is probably very specific to my situation. Thanks though
#8
Support / Clearing all objects upon config change
April 05, 2018, 04:18:13 PM
Hi,

I'm currently creating an app where a high number of objects are created and removed during the usage.
Now I want to make sure that config changes don't create weird scenarios.
The objects that I create are dependant on the lifetime of a real world object. When the real world object isn't present anymore, the on screen object also has to be removed.
Now this works perfectly fine during the usage of the app. However, when the real world object is present and a config change occurs, the objects stay on the screen and don't get deleted. The problem lays in that the world gets deleted before the app has the chance to remove the objects.
The error i get is: 
ERROR: Can't remove object #1, because it doesn't belong to this World!

TLDR: How can I delete individual objects independent of the world they are in, instead of having to call world.removeObject();