# Framerate() not working on P2D/P3D using intelij

**URL:** <https://discourse.processing.org/t/framerate-not-working-on-p2d-p3d-using-intelij/7768>\
**Category:** Coding Questions\
**Created:** [January 23, 2019, 4:55pm UTC](https://discourse.processing.org/t/framerate-not-working-on-p2d-p3d-using-intelij/7768 "2019-01-23T16:55:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![horia16](https://avatars.discourse-cdn.com/v4/letter/h/eb9ed0/32.png) [@horia16](https://discourse.processing.org/u/horia16)\
**Post date:** [January 23, 2019, 4:55pm UTC](https://discourse.processing.org/t/framerate-not-working-on-p2d-p3d-using-intelij/7768/1 "2019-01-23T16:55:42Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [January 23, 2019, 6:33pm UTC](https://discourse.processing.org/t/framerate-not-working-on-p2d-p3d-using-intelij/7768/2 "2019-01-23T18:33:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [January 28, 2019, 12:29am UTC](https://discourse.processing.org/t/framerate-not-working-on-p2d-p3d-using-intelij/7768/3 "2019-01-28T00:29:46Z")

</div>

> [@horia16](#):
>
> My game collisions are dependant of the framerate to be more accurate thus I need 120 fps

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:

> **[Unity - Manual: Continuous collision detection (CCD)](https://docs.unity3d.com/Manual/ContinuousCollisionDetection.html)**

(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.

---

<div class="post-metadata">

**Author:** ![desk](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@desk](https://discourse.processing.org/u/desk)\
**Post date:** [May 15, 2019, 2:29am UTC](https://discourse.processing.org/t/framerate-not-working-on-p2d-p3d-using-intelij/7768/4 "2019-05-15T02:29:53Z")

</div>

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](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.
