Orbit camera problems

Hi,

So I have set up a public project with the orbit camera I am currently using in a different project with similar functionality.

Basically, I am trying to get the camera to do the following but have had no luck (originally worked fine in Unity but now porting over to PlayCanvas problems are appearing :frowning: )

  • have camera start at editor position when running
  • when focusing on the chosen object, make sure the camera starts at the actual orbit node ready to orbit
  • when returning to global orbit, make sure the camera returns to spot we were at before focus

when running the scene these things can be noticed:

  • camera does not teleport to correct position, has a random pos/rotation regardless
  • camera does not return to cached position

If someone could take a look and possibly spot what I am doing wrong and how to fix it I would really appreciate it! I feel pretty silly that I can’t fix it but over in Unity everything seems fine! @will clarified the difference with the co-ordinate system being right handed rather than left. So I think some problems were originally because of that but now I think it’s something else.

The controls are:

  • click and drag to orbit around
  • double click boxes to focus on specific
  • when focusing, press space to return to global pivot

The following scripts are the ones that should hold the problem I just can’t figure it out:

  • RootHandler.js
  • SimpleOrbitCamera.js

Apologies in advance if any of the code is incorrect or it can be done a nicer way, I have only been working with js for a week now, so I’m still learning the tricks of the trade!

Thanks,
Gary