Hey people! I have this small patch that contains one draggable circle without making use of packing the whole thing into a custom object. Any ideas / suggestions on improvements? It works good, but it seems to me there could be better ways to program this. Feedback welcome!
Thanks! Almost the same… the mouse will “loose” the circle, when moved very quick, thats why in my example I also s+h the collision whenever the mouse goes up or down.
@bjoern why do you need the mouseup and the 2 if regions in allow move? is this a kind s+h logic? i cant tell because it seems to work fine without (using just the ouptput from the big AND)
Also added velocity to the circle. Now I want to keep it within the bounds of the window, but struggling with this, where should I put the Mirror / MapMirror node? Tried it after the position pad, but of course this would reverse half of all cases the mouse values…
Bjorn’s patch is the only correct one, as it doesn’t depend on the main loop FPS and it won’t do anything (and burn CPU cycles) when there is no mouse input event.
Doing everything in the main loop will run into the same problems you always had in vvvv beta.
the basics of this are explained in the first two examples in the reactive workshop from node20.
@tonfilm - “the only correct one” sounds a bit harsh :) maybe the most elegant or future-proof solution? I would argue that reactive programming is a rather advanced topic, and the other ways are totally fine for the fellow beginner patcher.
with respect on what @tonfilm said and with understanding what Framedifference might mean, this is how I was always doing till today (every single time) :/
more or less is the same approach as @chk , the only difference here is the FrameDifference in the if statement (this may cause issues in bigger patches) and the double togedge for a more consistent handling of the Circle.