Hi,
I’m using tracking.js to get the faces coordinates from an image.
coords = {
x : 38.12355469963794,
y : 96.47419166998122,
width : 106.33406420946123,
height : 102.4978113412857
}
I’m an absolute 3D and Babylon beginner, so far I managed to project the image texture on a plane with the right aspect ratio. But when it comes to draw a box over a face with the given coords
, I just can’t position get the right position.
Here is my attempt : https://www.babylonjs-playground.com/#0CSKL1 (the black box is suppose to be over the guy with the glasses)
Tried many configurations :
scene.createPickingRay(
coords.x,
coords.y,
BABYLON.Matrix.Identity(),
camera
).direction;
BABYLON.Vector3.Unproject(
new BABYLON.Vector3(coords.x, coords.y, 0),
engine.getRenderWidth(),
engine.getRenderHeight(),
BABYLON.Matrix.Identity(),
scene.getViewMatrix(),
scene.getProjectionMatrix()
)
faceBox.setPositionWithLocalVector(...)
faceBox.position = ...
Thanks.