Mapping Values

Hey everyone!

I’m trying to make a simple patch with a number of balls bouncing from each other (including one controlled by the mouse XY) and renderer boundaries. To perform a bounce from renderer window I wanted to use Map (Value) node (Source -1…1, Desitnation -1…1, mode - mirror). But after performing mapping on affected objects and returning all results back with FrameDelay node they tend to move to the 0;0 position.

What could be wrong with Map (Value) node settings?

travvvveler.v4p (73.0 kB)

it would be easier to help you if you made comments in your patch where your problem is

Sure! File with comments attached

travvvveler.v4p (76.5 kB)

Well, you may need

  • a s+h at some point. Imho, the balls get the new position that for some reason, at some point goes near 0,0 instead of the expect behavior.
  • to have a look at values fed to map, which are far beyond the -1,1 range, as, for what I can see, they roughly go from -20,20
  • to adjust destination values to something like -5,5 probably because here objects are scaled before being translated

  • Map works like this: Input is the value that should be transformed or mapped into another; Source Minimum and Source Maximum are respectively the lower and higher values that are passed to Input; Destination Minimum and Destination Maximum are respectively the lower and higher values into which Input must change or be transformed or mapped into

  • you could first add a framedelay below R < Newposix (id:380) and remove the other one

hm… still no luck. I’ve checked patch again and found some sorting errors that could cause balls moving to 0,0 (so, I guess, there’s no need for S+H). Also I’ve got rid of large values fed to map (right now it can’t be more than 1+2xballsize).

I don’t really get in Map node working principle. Desired mapping behaviour is to mirror X and Y values, that out of range (-1…+1) back separately. For example if colliding result produces (+0.5;-1.5) coordinates, Map node should convert it to (+0,5;-0,5). When I connect it to IObox it works excactly like this with same settings, but causes unexpected behaviour while in a loop.

bouncer.v4p (64.4 kB)

Attached my point of view on map node (2.9 kB)

Thank you for explanation! Finally got things done (animation is bit messy, but it’s ok for my purpose). My mistake was’nt in Map node (it worked excactly as I thought) but in some vector math before.

bouncer-2.v4p (61.4 kB)

All’s well that ends well