How to properly use the Transform method, looking_at

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By neoxid501

So I’m trying to have an object in 3D space always face the camera. I’ve actually gotten it to work, but the object’s position and scaling are completely lost when I use looking_at

Here is the code I’m using:

transform = transform.looking_at(cam.translation, Vector3(0 ,1, 0))

And the outcome when called:

before: 0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1 - 0, 1.43091, 1.76425
after: 0.279935, -0.200516, 0.938845, 0, 0.977944, 0.208866, -0.960019, -0.058469, 0.273761 - 0, 1.43091, 1.76425

When I spawn multiple instances of the object they all immediately move to the same space so I’m guessing that I’m using the method incorrectly. Any help would be appreciated, thanks!

:bust_in_silhouette: Reply From: MysteryGM

So I’m trying to have an object in 3D space always face the camera.

OK, quick cheat for this.
The Spatial Material has a billboard setting. After you made the material go to Parameters → Billboard Mode and select a option from the drop down; works with any mesh.

object’s position and scaling are completely lost when I use looking_at

I think this is a bug, it looks like a normelized version of the basis is used for look_at() and looking_at()

Ya that certainly helps!

I’ll post about it in the Discord and hope it can get further cleared up, thanks!

neoxid501 | 2018-12-12 05:29

Please fill me in if you get a answer to the looking at problem.

MysteryGM | 2018-12-12 16:18