[Notice of Holidays]
Please note that our staff will not be available from 2024/Dec/28 - 2025/Jan/5 JST.
The Live2D Creators Forum will remain open during the holidays.
Submissions that require a response will be answered after we reopen for business.
Please note that it will take longer than usual to respond to your request.
How to use the matrix in live2d
I want to transform and scale a live2d model.
Anyone can tell me how to do get this done.
How to use the two matrix below?
deviceToScreen=new L2DMatrix44();
viewMatrix=new L2DViewMatrix();
0 ·
Comments
deviceToScreen is a matrix to transform device coordinates to screen coordinates. For example, this object is used to get the coordination from touchEvent on screen (values like 1034.27, 328.63), and translate into parameters that Live2DModel uses (typically between -1 to 1).
viewMatrix is for perspective transformation. You can change the magnification and the coordination of the camera by modifying it.
I guess you are trying to scale only the model, not the whole screen. If so, then modelMatrix declared in LAppModel would be useful. To scale the model you can use setWidth() or setHeight(). setWidth() scales according to model's width, and setHeight scales according to model's height. As these methods would not change the aspect ratio, you only need to set one of them.
Also you can set the size explicitly.
1-d. Specify the position and the size
https://sites.google.com/a/cybernoids.jp/cubism_e/sdk_tutorial/live2d_library/load_to_display/display_mode
There are three screen size 1024x768, 1136x640 and 960x640 need to adapt.
My modal canvas is 960x640. And I found it shows a little strange in 1136x640 screen size. It scale bigger a lot.