Jump to content


  • Content Count

  • Joined

  • Last visited

  1. This technique has been working: http://phrogz.net/js/framerate-independent-low-pass-filter.html Basically, it's just: newValue += (prevValue - newValue) / smoothing; I'm using smoothing = 30.
  2. No a moving average doesn't work. I had better success with a low pass filter. Will post links and code in a few
  3. I'm using the `deviceorientation` event to get phone rotation data. And I'm noticing that at least on my device the rotation data is very "jumpy". That is it can look something like this: 0 -10 0 1 2 4 40 20 Have not had a change to try the Gyroscope API but I imagine it has the same limitation. My question is, does any one know of a technique to smooth of the rotation data. So in the above example, it would be `0, 0, 1, 2, 4, 20`. The use case is that when a user rotates the phone to the left/right, the app would apply a force vector. But with jumpy data like the above, the
  4. FYI. I ended up going with matter.js. It's battle hardened and less than 23kb.
  5. Is there a JavaScript library/technique to detect different types of sound? Yesi know this is kinda of a long shot but I'd like to detect clapping and blowing. So to clarify, the app would turn on the mic, then figure out when the user claps or blows. Update: this has potential https://www.tensorflow.org/js/tutorials/transfer/audio_recognizer
  6. Nice. As per bundlephobia, its 4kb. The use case is literally something similar to billiards. Objects need to push other objects in a somewhat realistic fashion, following the laws of physics. It doesn't need to be super realistic though. Is your library appropriate? Here's what i mean: balls need to bounce off each other as well as the walls. Friction and gravity should be supported. Suggestion: an examples sectiion would help a ton
  7. Use case: simple particle simulation with collision detection. Think billiards. For what I'm doing i prefer doing it myself. In fact i have done this in the past. So I'm looking for a refresher tutorial. Would also consider using a physics library. The only concern there is bundle size. It's for a web app so i need to keep download size to a minimum.
  8. Yea @Exca that was the issue. Ran the code locally via https and it worked fine. To clarify, this was android mobile chrome.
  9. Interesting. I've been following along tutorials online and running code locally. Hadn't noticed if these were running https. Will definitely try again :-) @Exca
  10. How do you guys do motion detection (if any) in your apps? Motion detection is when you detect when the user shakes their phone (for example). I just tried the following in Android Chrome to no avail: devicemotion event API. Supposedly it works on Chrome but it had no effect on my phones. See https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent. Interestingly, it did work on Firefox Focus this code snippet for cross-browser compatibility. Again, it did not work on Android Chrome. See https://stackoverflow.com/a/4378439/555493 the Gyroscope API. See h
  11. While simple because it requires no 3D, making it look "right" is likely very tricky... it definitely won't generalize to arbitrary terrains. I think the 3d plugin someone mentioned above is more promising :-) Thanks for the suggestion though
  12. Exactly. So should I be using a plugin? If so, which is the recommended one for this simple use case? As per the examples, I don't see 3D support out of the box
  13. I'm trying to do a super low-fi effect of lo-res procedurally generated terrain. (Think the HUD displays on the original terminator, or blade-runner cars.) What would be the best way of doing this with pixi? In the examples, I see references to various promising plugins.
  14. Here's the code in question: https://pixijs.io/examples/#/interaction/dragging.js bunny .on('pointerdown', onDragStart) .on('pointermove', onDragMove); function onDragStart(event) { // store a reference to the data // the reason for this is because of multitouch // we want to track the movement of this particular touch this.data = event.data; } // this is the example onDragMove function onDragMove() { if (this.dragging) { const newPosition = this.data.getLocalPosition(this.parent); this.x = newPosition.x; this.y = newPositi
  15. Is there recommended tooling to transform a pixi game into a mobile app?
  • Create New...