I want to make a camera orbit system like BMW

Nice to meet you.
I will post it for the first time.
Please forgive my terrible English.

I am a beginner of plyacanvas.

I want to make a camera orbit system like BMW.


I’d like to create a function to rotate the camera with the mouse and a function to move the camera to a predetermined place by pressing the button.

I tried to control the camera using two samples there.


Using the Tween library:

However, two samples do not work well at the same time.
I used OrbitCamera 's script for disabling while Tween was running.
However, when Tween completes its operation, if OrbitCamera 's script is enabled, it will not behave again.

This is an example of disabling a script.
this.MainCamera.script.enabled =false;

Is there a good way to do it?
Even if it is recommended sample, it will be greatly appreciated.

Thank you in advance for your cooperation.

Do you have a project that can be shared to look at?

I’m not a programmer, but I think from what I recall that code was out of date and didn’t work with new play canvas projects.

Thanks to everyone for your reply.
I will share the project.


I made two scripts, one is TweenController.js and MoveTrigger.js.
TweenController.js makes the camera Tween at the position of each entity.
MoveTrigger reacts when the button is pressed and sends the number of each Entity to Tween to TweenController.js.

TweenController.js is disabling Camera’s script.

Thank you so much everyone.

There are a few ways I can think of implementing this:

  1. Rather than tween the camera entity directly, tween camera via the orbitcamera.js script by using the method: resetAndLookAtPoint which allows you to move the camera to a specific point and also the point that the camera is looking at.

  2. Disable the orbitcamera.js script when the tween starts and when the tween finishes, use resetAndLookAtPoint to ‘reset’ the orbitcamera script to the current position and lookAt point and then enable the orbitcamera script again.

Thank you yaustar.
I will try it on your way.

Thanks yaustar.

I am likely to solve the problem with your help.