Raycast mouse clicks from Threejs model to the Fabricjs canvas used for the texture

三世轮回 提交于 2019-12-23 03:06:36

问题


I'm creating a 3D product configurator.

First, I load the .gltf model and render it with Threejs.

Then, I print a svg to a Fabricjs canvas and use that canvas to make a THREE.CanvasTexture and update the model with this canvas.

The problem
I allow people to upload text and images. Those images are added to the Fabric canvas as new objects. While the main svg is locked at the background, these uploaded images can be dragged and resized in the canvas.

Screenshot canvas object

Goal
So my goal is to be able to drag and resize those Fabricjs layers interacting directly from the visible 3D threejs model, not the canvas. Because the canvas is display:hidden

Image on the model

I'm new to this 3D world and can't find any example or guidence so i don't know where to start. I know i will have to use Raycasting, but don' know how to convert the points to the correct 2d canvas point and simulate click and drag actions.

来源:https://stackoverflow.com/questions/52840486/raycast-mouse-clicks-from-threejs-model-to-the-fabricjs-canvas-used-for-the-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!