Skip to content
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

Bounding Box not recalculated for animated 3D Models #168

Open
IvanCoronado opened this issue Feb 26, 2018 · 6 comments
Open

Bounding Box not recalculated for animated 3D Models #168

IvanCoronado opened this issue Feb 26, 2018 · 6 comments

Comments

@IvanCoronado
Copy link

I have a 3DObject like this
image

and I call findCollisionsWithRayAsync like this
image

I get false when I am pointing the chicken head and truewhen I point the belly or even a bit under the model.

I think that model and collider are not at the same point, have we a way to see collider visually?

PD: I have a cross in the centre of the screen (I understand that the ray is cast from the middle of the screen)

@dthian
Copy link
Member

dthian commented Feb 26, 2018

Hey @IvanCoronado, you can try toggling the collider visually with the drawBounds={true} property in the physicsWorld attribute under the viroscene control:
https://docs.viromedia.com/docs/viroscene#props

A caveat to the above is that currently, a static non-moving viro physics body does not dynamically reflect transformation changes that are caused by animations (which may be the case with your turkey man animations above).

What you've described above does sound like a bug though, could you take a screenshot (With the colliders on) at different parts of animation and paste it here? It would also be useful to have a copy of the turkey vrx file if possible. Thanks!

@IvanCoronado
Copy link
Author

image uploaded from ios

Even without animation, the collider is not covering the model. I will try with another model and with dynamic viro physics body.

@IvanCoronado
Copy link
Author

I am getting the assets from here https://docs.viromedia.com/docs/assets
I think that problem is related to the assets maybe they are floating or this just happens when the model doesn't fit in a cube.

image uploaded from ios 1
image uploaded from ios 2

@dthian
Copy link
Member

dthian commented Feb 28, 2018

Hey Ivan, I'm trying to get an idea of the context / background of what you are trying to do above.
Could you briefly explain what it is that you are trying to achieve?

I've taken a quick look at the code sample above, it seems like you might be changing state if the user 'gazes' at the 3D model? If so you can actually use our onHover APIs and should be supported in AR.

@dthian
Copy link
Member

dthian commented Mar 1, 2018

Hey @IvanCoronado, unfortunately you may still hit into the incorrectly calculated bounding box issue above. We are aware of this issue and have filed a bug in our backlog. I'll rename the issue to better reflect the bug so that we can track it and will update this issue once it has been pushed to release.

As a mitigation, you may be able to set a transparent box around your model such that correctly represents the onHover area coverage of your model. You can then set an onHover event on that box (try making the box semi - opaque first, so you can visually see where the box encompasses your 3D model to determine a "gaze zone"). You can then set your box to transparent with the following material below (note, do not use the opacity values to make your box transparent).

ViroMaterials.createMaterials({
  "clear" : {
    diffuseColor : "#00000000"
  }
});

To keep the transparent box and model scale in sync, you can then group the model and box under a parent node. You can then scale, move, rotate the parent node, of which should then scale the transparent box + model equally.

Apologies for the workaround, we'll update this issue once a fix has been released.

@dthian dthian changed the title findCollisionsWithRayAsync misaligned 50% with the Y axis Bounding Box not recalculated for animated 3D Models Mar 1, 2018
@vpallegar
Copy link

I was wondering if there was any update regarding this bug? I have an animated fbx file (converted to vrx) but the bounding box is not recalculating based on the skeleton animation. The bounding box seems to only stay where the initial animation begun at.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants