Weird behavior using camera.upVector

Hi everyone,

I have a problem in definition of camera orientation using the upVector property. Initially it has the correct orientation when program load, but when moves the camera it returns to the original value (0,1,0).

https://playground.babylonjs.com/#DCWXFS

I do not know if it is due to some error in the update, because the behavior is different from today.

It’s a bug?, I would appreciate any help.

Hi cienzorama,

I don’t know if this behavior has changed recently — @sebavan might know if that’s happened — but if you want to change the camera’s frame of reference while keeping the default controls, one thing to consider might be creating a parent node for the camera and putting your custom frame of reference on that.

https://playground.babylonjs.com/#DCWXFS#1

This should allow the camera to continue to operate as though it’s in a space it’s used to, but you can supersede that by moving and rotating the entire camera space anywhere you want to. Hope this helps, and best of luck!

thanks syntheticmagus,

I already knew this, it’s like what i done for now.

The point is that I want to place the camera on any position on a spheroid and upVector is easier than calculating the orientation angles.

Hey @Deltakosh and @PolygonalSun, it looks like my PR caused another issue that’s just been flagged here. I tried the above playground without the PR changes and can confirm it worked before the PR.

So I guess it should be un-merged, then if a way to fix the gimbal lock issue without causing this new issue can be found, will make a new PR for it? :slight_smile:

Good catch…Please make a PR to undo it and I will merge it immediatly

Here’s the PR to undo the changes (I had to close my other open PR to keep the changes separate but will reopen it after this one is merged). :slightly_smiling_face:

Merged! thanks!

Thanks Blake and Deltakosh, you guys are very efficient.

When you want to mark as solved it will be fine for me.