Rotate shape on pivot
Hey,
I'm a new user trying to create a simple patch to learn/experiment with Max 6. I'm trying to get a shape/s on an LCD display to rotate on a pivot point (circle motion) following (and controlled by) the position of the mouse, like "eyes". Hoping someone can help me with this, show me to a thread/tutorial that covers it?
Thanks,
Eric
In the lcd help file, check the mousing tab to read about the 'idle' attribute, and check the sprites tab to learn about sprites. Then use the mouse location to set the drawing location of the sprite(s).
Calculate circular motion using the sin() and cos() functions of the expr object (or using the cycle~ object).
Below is an example, but I don't mean to thwart your goal to learn by experimentation, so you might want to resist looking at the example till after you've read about those objects and tried building it yourself.
i recommend you use opengl for this.
the jit.anim.drive object will handle the spinning, the @anchor attribute will handle the pivot, and the gl.render screentoworld message will handle translating mouse coordinates to a position value.
Thanks for the tips, this is very close to what I was going for. I think I explained the "rotate" effect I'm going for a bit vaguely though.
I'm hoping to have the circle move/follow the mouse from a pivot point, and only when the mouse moves on the LCD (not an automatic rotation).
So what edits to your patches do I need to make so I can stop the automatic spinning, and have the circle move only on mouse movement?
(I got the circle to stop spinning on both patches but then it just "sticks" to where the mouse is on the LCD instead of "watching" it's position from a fixed location)
Ha, that was a mouth full!
Thanks