jnsmalm / pixi3d

The 3D renderer for PixiJS. Seamless integration with 2D applications.
https://pixi3d.org
MIT License
752 stars 43 forks source link

#53 Made CameraOrbitControl support touchscreen #163

Closed lovelle-cardoso closed 1 year ago

lovelle-cardoso commented 1 year ago

(Also added autoUpdate and camera accessor properties so these can be changed after instantiation. It's a small change, but I can separate it out into another PR if necessary.)

Our engine runs on both desktop and mobile devices so I needed CameraOrbitControl to support touch screen events.

To test:

  1. Run on touch screen device.
  2. Drag with one finger to change camera angle.
  3. Pinch-and-zoom with two fingers to change camera distance.
jnsmalm commented 1 year ago

Nice job! I have wanted this for some time but never took the time to implement it. It has a bug though, if "enableDamping" is set to false it doesn't work at all.

lovelle-cardoso commented 1 year ago

Nice job! I have wanted this for some time but never took the time to implement it. It has a bug though, if "enableDamping" is set to false it doesn't work at all.

@jnsmalm You're right! I think I've fixed it. Check if it works now.

jnsmalm commented 1 year ago

You're right! I think I've fixed it. Check if it works now.

Seems to work fine now!

lovelle-cardoso commented 1 year ago

@jnsmalm All right so I've moved the clamping and damping logic to updateCamera. X angle should be properly clamped now.

jnsmalm commented 1 year ago

Thanks a lot!