Framerate() not working on P2D/P3D using intelij

The title says it all. Is there a workaround or something? My game collisions are dependant of the framerate to be more accurate thus I need 120 fps for them to be pixel perfect. I can’t get an unlocked framerate using the framerate() function. it only works on the java renderer. Thanks!

Can you please post a small example program that demonstrates the problem?

Side note: It’s probably not a good idea to require 120 FPS for your collision detection to work. It’s going to be impossible to deploy your sketch in any reliable way.

Depending on what kind of collisions you are doing, you could try using non-framerate-based collision detection. There are many ways of doing this – it really depends on the details of how many bodies you have, which are fixed or moving, if the motion is angular, etc. Here is one overview of continuous collision detection (CCD) approaches:

(Note that this is from Unity documentation, not Processing, but covers the concepts well.)

In other words, every 60fps, you collision check tests or samples along the line between the last position and the current frame, giving it a higher resolution than your frame rate. No 120fps rendering needed, although your collision code will need to loop and/or perform more complex checks.

1 Like

I was on here looking for the reason I can’t increase the p5.js frameRate beyond 60, but I have the solution you are looking for in JAVA.

https://github.com/theluckyfellow/threeDBall

It allows the physics to run in a separate thread that is much fater than 60 interations per second. It actually ran at over 1000, and I had to put time management code in the loop to slow it down! Sorry the code is such a mess. I had to code it all in very sort amount of time and it was never meant to be public. I’m too busy to clean it up at the moment, sorry.

1 Like