Page 1 of 1

layer position

Posted: Sun Sep 12, 2021 3:18 pm
by davoodice2
hi friends. how to get later position? and how to set layer position?

Re: layer position

Posted: Sun Sep 12, 2021 3:39 pm
by synthsin75
moho.layer.fTranslation:GetValue(frame)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)

Re: layer position

Posted: Mon Sep 13, 2021 6:23 am
by davoodice2
synthsin75 wrote: Sun Sep 12, 2021 3:39 pm moho.layer.fTranslation:GetValue(frame)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)
thanks wes.

Re: layer position

Posted: Mon Sep 13, 2021 3:28 pm
by davoodice2
synthsin75 wrote: Sun Sep 12, 2021 3:39 pm moho.layer.fTranslation:GetValue(frame)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)
is it posssible to get right corner of viewport coordinates ?
and how get mouse position in vector?

Re: layer position

Posted: Mon Sep 13, 2021 5:54 pm
by synthsin75
davoodice2 wrote: Mon Sep 13, 2021 3:28 pm is it posssible to get right corner of viewport coordinates ?
and how get mouse position in vector?
The upper right corner is: moho.view:Width(), 0
The lower right corner is: moho.view:Width(), moho.view:Height()

2D layer mouse position is: mouseEvent.vec

Re: layer position

Posted: Mon Sep 13, 2021 8:29 pm
by hayasidist
synthsin75 wrote: Mon Sep 13, 2021 5:54 pm
davoodice2 wrote: Mon Sep 13, 2021 3:28 pm is it posssible to get right corner of viewport coordinates ?
and how get mouse position in vector?
The upper right corner is: moho.view:Width(), 0
The lower right corner is: moho.view:Width(), moho.view:Height()

2D layer mouse position is: mouseEvent.vec
just for clarity:

view:Height() etc is pixels in the Screen coordinate system (LM_Point)
mouseEvent.pt is also in the Screen coordinate system

mouseEvent.vec is the World coordinate system (LM_Vector2)

Conversion between the systems depends on the transforms such as layer translation, camera zoom etc etc but can be effected using
LM_Graphics:ScreenToWorld and LM_Graphics:WorldToScreen

Re: layer position

Posted: Tue Sep 14, 2021 7:18 am
by davoodice2
Thank you very much .I continue to learn with your helps