• Content count

  • Joined

  • Last visited

  • Days Won


royibernthal last won the day on September 17 2016

royibernthal had the most liked content!

About royibernthal

  • Rank
    Advanced Member
  • Birthday 11/28/1991

Profile Information

  • Gender

Recent Profile Visitors

749 profile views
  1. Hi Larry, Thanks for the PG. Hmm sure but it won't feel like a "clean" solution Even if it complicates things, I think I'd rather create a custom camera input, keeps the order in the code - that's what camera input is meant for. As for the math - it seems you increase the sensibility on mouse move infinitely, the longer you move the mouse around without releasing the higher the sensibility will get (it'll grow each time according to distance between down and move points). I think the right way to tackle it would be to have a fixed calculation taking into account move and down points, and translating to a number within range of max vertical and horizontal drag distance, which at least in PG case is within around 0-900, while default sensibility is 1000, making it ideal to have some sort of min-max range according to percentage of drag distance out of default sensibility. (min-max range will be predefined to make sure the sensibility isn't too high and isn't too low)
  2. Sounds good
  3. Thanks, I'll look into it
  4. I'm trying to center a 3D object in a scene (for the sake of this question). Calculating stage size simply according to canvas dimensions doesn't work, e.g. if in PG the canvas width is 960, then the x position of the sphere can be between around -10 to 10 meaning the "screen width" I can play with is around 20. I imagine I need to somehow take into account the camera z, and possibly other parameters. Here's a PG where you can see more or less what I'm trying to do: By the way I'm not looking for some workaround of setting the camera target to an object or something of the sort, I'd like to really understand how to calculate such a thing.
  5. Anyone?
  6. I don't really understand what you mean. Can you please clarify? An example would be great.
  7. The same would apply to that no? I'd need to save the radius when the user clicks and compare it to the updated radius every scene render. Or does the radius represent that actual difference between start position (on click) and current position?
  8. Is the distance exposed anywhere or am I supposed to calculate it myself by listening to mouse events? I think it's calculated here but it's not really exposed:
  9. Any idea?
  10. I'd like to have an ArcRotateCamera which rotates slower the further the mouse is from the click/touch point (while still pressed/touched). Imagine pressing/touching anywhere, that's point A, dragging towards some direction to rotate the camera (point B updated while dragging), then releasing. (the same thing that happens now basically) The further pointA is from pointB, the smaller the sensitivity of the camera rotation. I cleared all inputs and have only mouse input now (PointersInput). Is there some built-in functionality for such a thing or would I have to implement my own camera input? If the latter - is there a way to modify an existing camera input or would I have to build one from scratch?
  11. I'm pro throwing an exception as you already know I think what you did could end up being even more confusing and harder to debug than a soft warning message, especially in complex cases. The new shortcuts sound good though.
  12. @fenomas Something felt weird and I wasn't able to put my finger on it. This was some old undocumented code which I decided to "upgrade" from iterating over arrays to iterating over objects as well. The original intention was to allow passing multiple objects to this functions in an array, manually and intentionally, and not to recursively iterate over objects. Needless to say, I documented it so I won't forget it again static dispose(value: any | any[]): void { if (value == null) return; if (value instanceof Array) value.forEach(item => MemoryUtils.dispose(item)); else if (value.dispose != null) value.dispose(); } Thanks for the help everybody, your answers are helpful if I were to stick with the approach mentioned in the topic.
  13. Hey, to the best of my understanding it's not really related to what I'm doing. Correct me if I'm wrong.
  14. Second option looks good, like you mentioned in the mail, the "defines" part is what I need, it'd be great to have an observable for that. (I don't mind having vertex and fragment as well)
  15. Not sure I understand how this is related, care to elaborate?