sceneview-android
sceneview-android copied to clipboard
Fix Node and LightNode look methods
Please don't merge yet
There is one problem:
If the parent is doing a smooth transform, then the worldToParent
that we use in the child is based on the parent's transform not smoothTransform
and that causes problems. For example if we do this:
parentNode.lookAt(sceneView.camera.worldPosition, smooth = true)
childNode.lookAt(sceneView.camera.worldPosition, smooth = true)
the child will do a wrong rotation and it's like it does double the rotation that was needed to look at the camera and will end up not looking at the camera. Any ideas how we can fix this? Btw, changing:
open val worldTransform: Mat4
get() = parentNode?.let { it.worldTransform * transform } ?: transform
to:
open val worldTransform: Mat4
get() = parentNode?.let { it.worldTransform * smoothTransform } ?: smoothTransform
makes everything so slow and laggy and also removes the smooth effect.