Revert "add mouse wheel camera rotation"
This reverts commit 417bf4ea63ec4e979dba4f583b10a379df531a62.
This commit is contained in:
parent
220a451475
commit
f966d538d3
@ -10,7 +10,6 @@ var (
|
|||||||
cameraDistance = float32(20.0)
|
cameraDistance = float32(20.0)
|
||||||
cameraYaw = float32(145.0)
|
cameraYaw = float32(145.0)
|
||||||
cameraPitch = float32(45.0)
|
cameraPitch = float32(45.0)
|
||||||
lastMousePos rl.Vector2 // Add this to track mouse movement
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateCamera(camera *rl.Camera3D, player rl.Vector3, deltaTime float32) {
|
func UpdateCamera(camera *rl.Camera3D, player rl.Vector3, deltaTime float32) {
|
||||||
@ -33,34 +32,6 @@ func UpdateCamera(camera *rl.Camera3D, player rl.Vector3, deltaTime float32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle middle mouse camera rotation
|
|
||||||
if rl.IsMouseButtonDown(rl.MouseMiddleButton) {
|
|
||||||
currentMousePos := rl.GetMousePosition()
|
|
||||||
|
|
||||||
// If we just started holding the button, initialize last position
|
|
||||||
if !rl.IsMouseButtonPressed(rl.MouseMiddleButton) {
|
|
||||||
mouseDelta := rl.Vector2{
|
|
||||||
X: currentMousePos.X - lastMousePos.X,
|
|
||||||
Y: currentMousePos.Y - lastMousePos.Y,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adjust rotation speed as needed
|
|
||||||
cameraYaw += mouseDelta.X * 0.5 * deltaTime * 60
|
|
||||||
cameraPitch += mouseDelta.Y * 0.5 * deltaTime * 60
|
|
||||||
|
|
||||||
// Clamp pitch to prevent camera flipping
|
|
||||||
if cameraPitch < 20 {
|
|
||||||
cameraPitch = 20
|
|
||||||
}
|
|
||||||
if cameraPitch > 85 {
|
|
||||||
cameraPitch = 85
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lastMousePos = currentMousePos
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep the keyboard controls too
|
|
||||||
if rl.IsKeyDown(rl.KeyRight) {
|
if rl.IsKeyDown(rl.KeyRight) {
|
||||||
cameraYaw += 100 * deltaTime
|
cameraYaw += 100 * deltaTime
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user