Transform mouse coordinates to local space

About Monkey 2 Forums Monkey 2 Programming Help Transform mouse coordinates to local space

This topic contains 3 replies, has 2 voices, and was last updated by  Voidwalker 1 year, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10971

    Voidwalker
    Participant

    Hi,

    in Monkey 1 I could transform mouse coordinates into local space of an image like this:

    [/crayon]

    where “m” is a matrix which I got with GetMatrix() during drawing that rotated image (in a PushMatrix() / PopMatrix())

    How can I achieve that in Monkey 2? Thanks

    #10972

    Mark Sibly
    Keymaster

    Same idea, just transform the point directly, something like:

    Note the minus sign before canvas.Matrix. This negates the current canvas matrix, so gives you the inverse transform.

    #10973

    Mark Sibly
    Keymaster

    Actually, the simplelight banana shows you how to do this…it does a funky rotate/distort of the view and converts mouse coords to ‘local’.

    #10974

    Voidwalker
    Participant

    Thank you Mark! Time to go to bed now or have you been waked up by this “emergency call test” via mobile phones in NZ?

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

You must be logged in to reply to this topic.