Closed sonvuhoang closed 2 years ago
Hey, for now you have to call material.project(mesh)
each frame, but in the future this may be simplified.
Hi, thanks for the quick response! I adapted your basic example to include:
webgl.onUpdate(() => {
if(webgl.isDragging){
material.project(box)
}
})
When I drag to another side of the box, the projection stays in the original position. Did I misunderstand what "each frame" meant?
You have to change the projector camera position (the one with the helper), not the view camera.
You can take instead the example where the projector camera and the view camera are the same, the same-camera example, and add this in the webgl.onUpdate()
call:
elements.children.forEach((element) => {
element.material.project(element)
})
This should be the result
https://user-images.githubusercontent.com/7217420/152066480-7c62b65b-8d66-4398-90d8-a55b8182deda.mov
Thanks, I got it working! I didn't realize I had to change the projector camera position instead of the view position.
Is it possible to update the projection of the texture to follow the camera position?
This question has already been asked before, but since the repo has changed so much since it was asked, what changes do I need to make to get this to work?