Fix `Uncaught TypeError: (intermediate value).now is not a function` on clock.getDelta()
See original GitHub issueIt seems like there is something wrong with the clock now.
On my FPS game, my clock.getDelta()
works just fine on my animated character.
But on another page, running clock.getDelta
returns:
Uncaught TypeError: (intermediate value).now is not a function
I copied the exact code from the other page, still does it.
I event did a shift+reload on my working page to make sure any changes from the three.js library were synced.
It still works on that page.
I clicked the link on the error which brought me to the debug tab in Firefox.
It seems what you’re doing though is:
function jc(){return("undefined"==typeof performance?Date:performance).now()}
And the clock.getDelta
function is calling that jc
function.
What I see is right here:
("undefined"==typeof performance?Date:performance).now()
This is where the error is coming from.
I recommend you fix it with this:
("undefined"==typeof performance.now?Date.now():performance.now())
I made it check for performance.now
instead of just performance
because it seems performance.now
does not exist anymore.
Running this code in my console runs smoothly and free of errors.
Until you fix this bug I will use the custom code I made.
Issue Analytics
- State:
- Created a year ago
- Comments:15 (3 by maintainers)
Top GitHub Comments
The first thing you do in your code is declare a “performance” function and overwrite the the global field…
Please use the three.js forums for three.js help or StackOverflow for general Javascript help.
To be clear that is not what I recommend. Please use the forum or stackoverflow if you’d like help on what’s gone wrong with your javascript.