google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

Request: Can we have a "transform" parameter within the com.google.ar.sceneform.Node class? #320

Open ChronoAndross opened 6 years ago

ChronoAndross commented 6 years ago

So I've found that we have a huge problem with some of the transforms that we are using because they are mirrored matrices. Sceneform seems to only have support to express the rotations of Sceneform nodes via the localRotation or the worldRotation parameters as quaternions. As you probably know, one cannot express the rotations of mirrored matrices in quaternions.

Currently, when I ask the Quaternion class to interpret a mirrored matrix, it feeds back the identity matrix. This is because it can't express rotations within a mirrored matrix as far as I know.

Because of this, I fear we might have to do the following, which might be a lot of work:

For all flipped matrices in our scene, we would have to:

  1. Check to see if the matrix is mirrored
  2. If it is, multiply all vertices (thus creating a new RenderDefinition) and pass the identity matrix over instead. This could potentially be cumbersome and add a lot of nodes that could slow down the scene.

In my opinion, it is far easier to have a transform parameter, and then just use that to represent the rotation, translation, and scale of the vertices attached to the node. Apple already has this for their nodes as seen here: https://developer.apple.com/documentation/scenekit/scnnode/1407964-transform .

Any help with this would be much appreciated.

claywilkinson commented 6 years ago

@ChronoAndross - Thanks for the feedback. This feature request has been added internally. We'll update this thread when there is updated information.