tall-teacher-57409
05/25/2023, 5:07 AMhx
public static function onMouseMove(x:Float, y:Float) {
if (firstMouse) {
lastX = x;
lastY = y;
firstMouse = false;
}
sensitivity = 0.1;
xOffset = x - lastX;
yOffset = lastY - y;
lastX = x;
lastY = y;
xOffset *= sensitivity;
yOffset *= sensitivity;
yaw += xOffset;
pitch += yOffset;
if (pitch > 89.0)
pitch = 89.0;
if (pitch < -89.0)
pitch = -89.0;
var direction:Vector4 = new Vector4();
direction.x = Math.cos(yaw * Math.PI / 180) * Math.cos(pitch * Math.PI / 180);
direction.y = Math.sin(pitch * Math.PI / 180);
direction.z = Math.sin(yaw * Math.PI / 180) * Math.cos(pitch * Math.PI / 180);
direction.normalize();
front = direction;
}
onMouseMove handler looks fine to me ðŸ˜