raylib-go
raylib-go copied to clipboard
function rl.UpdateCamera() isn't able to move the camera
Expected behavior: When I pass rl.CameraFree as a mode to UpdateCamera() and press W/A/S/D it will move me in the corresponding behavior Actual behavior: It dose nothing when I press W/A/S/D.
My system: Alpine linux mesa-25.0.5 6.12.26-1-lts river (wayland) go version go1.24.2 linux/amd64 AMD Ryzen 5 3400G I am on the latest version of raylib-go
You can reproduce it with the flowing code:
package main
import (
"strconv"
rl "github.com/gen2brain/raylib-go/raylib"
)
func main() {
rl.InitWindow(1080, 720, "Raylib")
defer rl.CloseWindow()
rl.SetTargetFPS(60)
var camera rl.Camera3D
camera.Position = rl.Vector3{X: 10, Y: 10, Z: 10}
camera.Target = rl.Vector3{X: 0, Y: 0, Z: 0}
camera.Up = rl.Vector3{X: 0, Y: 1, Z: 0}
camera.Fovy = 45.0
camera.Projection = rl.CameraPerspective
rl.DisableCursor()
for !rl.WindowShouldClose() {
rl.UpdateCamera(&camera, rl.CameraFree)
rl.BeginDrawing()
{
rl.ClearBackground(rl.White)
rl.BeginMode3D(camera)
{
rl.DrawCube(rl.Vector3{X: 0, Y: 1, Z: 0}, 2.0, 2.0, 2.0, rl.Brown)
rl.DrawCubeWires(rl.Vector3{X: 0, Y: 1, Z: 0}, 2.0, 2.0, 2.0, rl.Black)
rl.DrawGrid(80, 1)
}
rl.EndMode3D()
rl.DrawRectangle(0, 0, 90, 90, rl.Black)
rl.DrawFPS(0, 0)
rl.DrawText("X: "+strconv.Itoa(int(camera.Position.X)), 0, 20, 20, rl.White)
rl.DrawText("Y: "+strconv.Itoa(int(camera.Position.Y)), 0, 40, 20, rl.White)
rl.DrawText("Z: "+strconv.Itoa(int(camera.Position.Z)), 0, 60, 20, rl.White)
}
rl.EndDrawing()
}
}
or this example .
I would also like to add that you can't use the mouse to move.
Hello. I have failed to reproduce the issue.
SETUP
- Linux archlinux 6.14.4-arch1-1
- AMD Ryzen 7 8845HS w/ Radeon 780M Graphics
- wayland(GNOME)
- same go setup as the issuer / updated raylib-go to test out
It works here without any issues. @tuzu128 Can you try something other than river (wayland)?
It also doesn't work with sway, I can try X11 next.
I have now also tried lxqt on X11 And it also doesn't work, it may be a musl lib C problem.
You can also try with RGFW and SDL backends.
I will try it with SDL an another machine also running Alpine, than I can also try something like arch in a VM.
I am sorry but I won't be able to get to my computer for about 2 days, I will test it later.
It doesn't work using GLFW under fedora distrobox. May I ask how do I compile it using sdl2?
@tuzu128 All available build tags are on README page, you use it with -tags.
It works with SDL, sorry for my late response.
Does it work with RGFW? Also, with SDL, does it work with both Wayland and X11? And musl is not related to any of that, right? Anyway, nothing to fix in this repo, but it would be nice if your issue could be pinpointed to something concrete.
It worked under musl Wayland with SDL. I haven't tried RGFW
I managed to reproduce the issue on another laptop. Almost identical software, but it is connected to an external monitor and keyboard. It may be related to this repository, as the camera functions have been rewritten from C. However, it is interesting that it works in both SDL and RGFW, but not in GLFW. I will look into this more when I find the time. @tuzu128, you also have some setup that involves another monitor?
I only have one monitor which is connected to the PC, I am on a desktop.
recreated this locally myself. for me it was a virtual device being picked up as a gamepad. Keychron Link was being detected as a gamepad
I did not test specific backends though
(I was on windows for my recreation)