Repository navigation
Open
Description
When the fps is higher than approximately 500, the camera starts bugging out with it glitching. If the fps is at a fixed rate like 60 fps, then the camera starts acting normal. Here's the code that I wrote, could be a issue in my code or the library itself. Note: my code is running at 60 tps if that could be the issue also, although it doesn't seem like it...
package com.Continuity.camera;
import static com.raylib.Raylib.*;
public class PlayerCamera {
// use CAMERA_ORBITAL later
private static Camera3D camera = new Camera3D();
private float cameraSensitivity = 0.005f;
private float cameraYaw = 0f;
private float cameraPitch = 0f;
public void init(Vector3 startPos) {
camera._position(startPos);
camera.target(new Vector3().x(0).y(0).z(0));
camera.up(new Vector3().x(0).y(1).z(0));
camera.fovy(60);
camera.projection(CAMERA_PERSPECTIVE);
}
public void tick(Vector3 playerPos) {
Vector2 mouse = GetMouseDelta();
cameraYaw -= mouse.x() * cameraSensitivity;
cameraPitch -= mouse.y() * cameraSensitivity;
if (cameraPitch > 1.5f) {
cameraPitch = 1.5f;
}
if (cameraPitch < -1.5f) {
cameraPitch = -1.5f;
}
float cosPitch = (float) Math.cos(cameraPitch);
float sinPitch = (float) Math.sin(cameraPitch);
float sinYaw = (float) Math.sin(cameraYaw);
float cosYaw = (float) Math.cos(cameraYaw);
Vector3 direction = new Vector3().x(cosPitch * sinYaw).y(sinPitch).z(cosPitch * cosYaw);
Vector3 eye = new Vector3().x(playerPos.x()).y(playerPos.y() + 1.6f).z(playerPos.z());
camera._position(eye);
camera.target(new Vector3().x(eye.x() + direction.x()).y(eye.y() + direction.y()).z(eye.z() + direction.z()));
}
public float getYaw() {
return cameraYaw;
}
public static Camera3D getCamera() {
return camera;
}
}
Metadata
Metadata
Assignees
Labels
No labels
Activity
electronstudio commentedon May 21, 2026
You could try using release 5.5.0-2 . If that works then the issue is either something in Raylib 6 or in our switch to SDL backend. If you want anyone to try running your code you'll have to post a complete program, not just a code snippet. Also I'm not sure there are any monitors that can display 500fps so I don't understant why it matters how anything behaves at that rate. It could even be a floating point accuracy thing, with the deltas getting so small at that rate they can't be accurately represented in a float. (What happens if you use doubles instead?) You'll probably get better advice on this from Raylib experts on the Raylib discord (even though they will make fun of you for using Java and not C).