Fix wrong sign when converting from dir to yaw pitch
This commit is contained in:
parent
5181b9b813
commit
a958c1f50a
@ -898,24 +898,20 @@ collect_camera_input :: proc() -> (delta: rl.Vector2, sense: f32, is_mouse: bool
|
||||
}
|
||||
|
||||
should_capture_mouse := rl.IsMouseButtonDown(.RIGHT)
|
||||
@(static) last_mouse_pos: rl.Vector2
|
||||
if g_mem.mouse_captured != should_capture_mouse {
|
||||
if should_capture_mouse {
|
||||
rl.DisableCursor()
|
||||
last_mouse_pos = rl.GetMousePosition()
|
||||
} else {
|
||||
rl.EnableCursor()
|
||||
}
|
||||
g_mem.mouse_captured = should_capture_mouse
|
||||
}
|
||||
|
||||
mouse_delta := g_mem.mouse_captured ? rl.GetMouseDelta() : 0
|
||||
|
||||
@(static) first_delta := true
|
||||
if mouse_delta != 0 && first_delta {
|
||||
first_delta = false
|
||||
mouse_delta = 0
|
||||
} else if mouse_delta == 0 {
|
||||
first_delta = true
|
||||
}
|
||||
mouse_pos := rl.GetMousePosition()
|
||||
mouse_delta := g_mem.mouse_captured ? mouse_pos - last_mouse_pos : 0
|
||||
last_mouse_pos = mouse_pos
|
||||
|
||||
MOUSE_SENSE :: 0.005
|
||||
GAMEPAD_SENSE :: 1
|
||||
@ -967,7 +963,7 @@ orbit_camera_to_rl :: proc(camera: Orbit_Camera) -> rl.Camera3D {
|
||||
}
|
||||
|
||||
dir_to_yaw_pitch :: proc "contextless" (dir: rl.Vector3) -> (yaw: f32, pitch: f32) {
|
||||
pitch = math.asin(dir.y)
|
||||
pitch = -math.asin(dir.y)
|
||||
yaw = -math.atan2(dir.x, dir.z) + math.PI
|
||||
return
|
||||
}
|
||||
@ -1189,9 +1185,6 @@ update :: proc() {
|
||||
car_follow_cam := &game_cam.(Car_Follow_Camera)
|
||||
car_follow_cam.body = world.car_handle
|
||||
|
||||
if world.physics_dt == 0 {
|
||||
log.debugf("phys dt == 0")
|
||||
}
|
||||
game_camera_update(world, &get_runtime_world().game_camera, dt)
|
||||
get_runtime_world().camera = game_camera_to_rl(get_runtime_world().game_camera)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user