Anyone know how to make the look-at function works for an object inside the Target Tracker hierarchy to always look at the Camera?
I’ve tried to debug this but seems like when we test it on the device, camera position is not working. it works in the simulation and in Spark Studio, but completely fails on device.
The Camera position doesn’t update it’s value after we put target tracker on the scene. it works if we use plane tracker. it doesn’t work if we have plane tracker + target tracker.
can someone confirm this issue?
if you can make it works, do you mind to guide me/us on how to use the look at function or any work around to make object in target tracker always looking at the camera position (camera position, not camera view vector)?
Do you have an example project to share? It would be helpful to see your configuration - maybe there’s a simple fix.
test lookat basic.arexport (2.5 MB)
it kinda works but not like what I expected.
What I want is that those looker objects are still staring at the camera origin point even if we are looking at different angles. But what I have now is that they are only looking at the camera directly if we also looking at them back. I’ve experimented with two different approach in that script which somehow it comes up to the same result. I’ve also tried to use shader generic approach in patch asset in spark sl in different project, but it also gives me the same result. but in the shader generic approach it’s works perfectly if we flatten the z scale. so it behaves exactly like 2d billboarding particle. I want that to also be achievable but for 3d object not flat plane or flattened 3d object.
it works fine and like what we expected if the looker, parent and target are in the same local space and we just use .transform instead off .worldTransform so yeah, it’s super confusing.
This has to be bugged. I tried moving the looker outside of the target tracker and then getting the world position from a null inside the target tracker, but it just makes the object disappear. The values aren’t crazy out of range, and if I set them manually, it works.
I know in the past I’ve had some trouble with the lookAt function so I ended up rendering my 3D object into a particle texture and then used the billboarding feature of the particle emitter. Maybe that could work for you.
Came across this article today. Could be a cool exercise to create your own lookAt function. It’s possible it will work more reliably than the built-in function.
so, is that going to be a spark SL method with custom patch asset material? Cuz I’m still unfamiliar with setting up material from script. Also it’s kinda getting way too complex if it only accessible via spark sl, cuz then we have to set up custom PBR or Standard shader inside it too and also it’s only convenience if we assume the object with lookAt is only consist of 1 material and no child objects. would be preferable using a method that we can apply to a null or a parent object so their child is also going to orient their rotation accordingly.
Yeah, you would need to apply the transformation matrices in a vertex shader, which is pretty tedious. I know Dennis did that for some of his effects, but the workflow seems like a pain.
Yup, I just tried that method you mentioned above, and after fiddling around a little bit with the difference of coordinate system I managed to make it work, but just like what we expected, it really doesn’t worth the hassle to set it up, pretty tedious and limited to flat shading which we would have to set up our custom PBR material ourselves. I hope Spark can provide a better documentation with more examples on how to play around with transforms between spaces and on different trackers because quaternion and basically all object transforms are quite essential for any platform that offer 3D object interaction.