1

I have created multiple 3D Cubes in a HTML5 Canvas . I was trying to handle a click event on the 3D cube so that i can know which cube got clicked. To create the cube I used processingJS. It worked well but was not able to get the Click position. I read about Paper JS which creates a shape and stores it in a object.
Is it possible to create 3D things with Paper JS. Or Is there anyway i can get which cube got clicked through ProcessingJS. please share whether there are any other ways to do this.

Thanks in advance.

1 Answers1

1

Paper.js deals with 2D vector graphics.

While in theory you can represent a cube if you want to, using skewed squares for example, it will take a lot of effort and a lot of time to just create 1 cube.

You are much better of using a 3D library, e.g - Three.js.

Here is an already cooked up example using raycasting to detect the clicks on a side of the cube: http://mrdoob.github.io/three.js/examples/canvas_interactive_cubes.html

nicholaswmin
  • 21,686
  • 15
  • 91
  • 167