Light issues with custom camera

I need a camera which is similar to an ArcRotateCamera, but with more “intuitive” rotations, so I customized a basic Camera class. I’m not yet done with the rotations, but what I already noticed is that the light behaves differently and I guess, my camera is missing some required attributes.

Here’s the PG.
Update with working rotation: PG

You can switch between my custom camera and an ArcRotateCamera with the boolean in the first line. As you can see, the two light sources are rendered incorrectly with my custom camera. [The final goal is to attach the two lights to the camera (as parent) but I commented that out for now.]

Any ideas what is missing are highly appreciated! Thanks in advance! :pray:

cc @PolygonalSun

I’m not quite sure that anything obvious stands out to me though I’m not too familiar with lighting. I’d imagine that there’s something that’s missing to update the lighting (callback or observable maybe?). @sebavan or @Evgeni_Popov, I don’t suppose you’d have any ideas, would you?

1 Like

@7om your code does not update globalPosition which is used by the babylon materials:

here is how the target camera is doing.


@sebavan thanks a lot! That solved the issue. :partying_face:

I found it quite challenging to implement all the required stuff based on Camera to get a working customized camera. A template (or abstract base) class which points to all the required attributes and methods would have been very helpful (like the _cache stuff or this _globalPosition attribute). Or just a PG which is kept up to date. I know, so much one could do and so little time…

Agree this is a nice topic to document cc @PolygonalSun and @PatrickRyan