Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Please limit one question/topic per post.
Please provide the following details depending on types of question

▼ For question regarding Editor, please provide:
- Live2D Software Version: (e.g. Cubism Editor 3.1.02, Euclid Editor 1.2.02)
- OS & Version: (e.g. Windows 10, macOS HighSierra)
- PC Model: (e.g. MacBookPro 2017)
- Graphics Specifications: (e.g. GeForce GTX 950M)
- Memory: (e.g. 8GB)
- Illustration Software used: (e.g. Photoshop, ClipStudio, SAI)
- Attach screenshot or capture video to show your problem:
▼ For question regarding SDK, please provide:
- For us to reproduce the issue you wish to inquire about, please provide either a minimum project file which has the issue. or specific instructions on how to reproduce the issue.
- Types and version of Cubism SDK you are using.
▼ For question regarding Cubism Software License,
For issues related to purchasing, your order, license key, and subscription, please contact us via contact form:

Live2D model position in Cocos2D-X

Hello :)

Im having some issues manipulating the matrix of my Live2D model in cocos2d-x. Let me explain what I want to achieve :
- I want to be able to position my Live2D model using Cocos2D X and Y coordinates.
- I want the model to scale from one screen size to another

For example, when im working in my design resolution (1024*768) I'll specify that my model is drawn at X=350 and Y=768 (that's just an example with random value).
So, I want the render on smaller and bigger resolution to be the same as what I see when Im in 1024*768.

What I have so far :
float scx = (2 / live2DModel->getCanvasWidth());				//Rate of magnification of x axis
float scy = (-2 / live2DModel->getCanvasWidth());				//Rate of magnification of y axis
float x = 0;		//X from 0 to 1024 (design resolution width)
float y = 200;		//Y from 0 to 768 (design resolution height)
float rto = (float)w / h;

float posx = (scx * x);		//Tying to scale X
float posy = (scy * y);		//Trying to scale Y

float matrix[] = {
		scx  , 0  , 0 , 0 ,
		0  , scy , 0  , 0 ,
		0, 0, rto, 0,
		posx, posy, 0, rto

All my game scaling is defined by CC_CONTENT_SCALE_FACTOR(), which is calculated by cocos2d.
How can I achieve the desired behaviour ?
Im not sure I understand correctly why we need to set scx and scy to those value, why do we use 2 and -2 ? shouldn't we use the scale factor ?

Thanks you :)
Sign In or Register to comment.