I want the camera movement made with the mouse to be the same as on this site. https://bruno-simon.com/
my codes but it doesnt work:
document.addEventListener("mousedown", function (event) {
previousMousePosition.x = event.clientX;
previousMousePosition.y = event.clientY;
$("body").removeClass("grab");
$("body").addClass("grabbing");
});
document.addEventListener("mouseup", function () {
$("body").removeClass("grabbing");
$("body").addClass("grab");
var deltaMove = {
x: event.clientX - previousMousePosition.x,
y: event.clientY - previousMousePosition.y,
};
// Kameranın pozisyonunu güncelle
camera.position.x -= deltaMove.x * 0.05;
camera.position.z -= deltaMove.y * 0.05;
// Önceki fare konumunu güncelle
previousMousePosition = {
x: event.clientX,
y: event.clientY,
};
});
New contributor
Sencerhan.Com is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.