feat: add physical camera marker on 3D court (1m from net, center, 1m height)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ruslan Bakiev
2026-03-07 11:18:37 +07:00
parent dc79763dab
commit 7c8a87f9be

View File

@@ -506,6 +506,9 @@ function initCourtScene() {
courtScene.add(new THREE.AmbientLight(0xffffff, 0.8));
// Physical camera marker: 1m from net, center, 1m height
addCameraMarker(courtScene, 7.7, 3.05, 1);
// Load existing calibration cameras
fetch('/api/calibration/data')
.then(function(r) { return r.json(); })
@@ -604,6 +607,9 @@ function initTrajectoryScene() {
trajScene.add(new THREE.AmbientLight(0xffffff, 0.8));
// Physical camera marker: 1m from net, center, 1m height
addCameraMarker(trajScene, 7.7, 3.05, 1);
function animateTraj() {
requestAnimationFrame(animateTraj);
controls.update();
@@ -620,6 +626,33 @@ function initTrajectoryScene() {
});
}
// ===================== Camera marker =====================
function addCameraMarker(scene, x, y, z) {
// Camera body (box)
var body = new THREE.Mesh(
new THREE.BoxGeometry(0.2, 0.15, 0.15),
new THREE.MeshBasicMaterial({ color: 0x44aaff })
);
body.position.set(x, y, z);
scene.add(body);
// Lens (cone pointing toward net at x=6.7)
var lens = new THREE.Mesh(
new THREE.ConeGeometry(0.06, 0.15, 8),
new THREE.MeshBasicMaterial({ color: 0x2288dd })
);
lens.rotation.z = Math.PI / 2; // point along -X toward net
lens.position.set(x - 0.17, y, z);
scene.add(lens);
// Pole from ground to camera
var poleGeo = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(x, y, 0),
new THREE.Vector3(x, y, z)
]);
scene.add(new THREE.Line(poleGeo, new THREE.LineBasicMaterial({ color: 0x666666 })));
}
// ===================== Draw court lines =====================
function drawCourtLines(scene) {
var mat = new THREE.LineBasicMaterial({ color: 0xffffff });