Forums > MaxMSP

Rotate shape on pivot

March 26, 2014 | 11:14 pm

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


March 27, 2014 | 7:51 am

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.

<code>

– Pasted Max Patch, click to expand. –

</code>


March 27, 2014 | 10:54 am

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.

– Pasted Max Patch, click to expand. –

March 27, 2014 | 5:03 pm

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


Viewing 4 posts - 1 through 4 (of 4 total)