[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.
Multiple models when using TranslateRelative()
When selecting only one model and translate it like this:
modelToUse->GetModelMatrix()->TranslateRelative(speed,0);
but when i have multiple models on the scene they move instead of only the selected one
(for example: if model number 1 is selected models 2 and 3 will Translate too).
0 ·
Answers
Thank you for reaching out.
Could you tell me how you are implementing the display of multiple models?
If you are using one ModelMatrix for each model, make sure that you have an instance for each model and see if the same problem occurs.
by adding a new instance to _models.
Example code:
_models.PushBack(new LAppModel());
_models[_models.GetSize()-1]->LoadAssets(modelPath1.c_str(), modelJsonName1.c_str());
is there any way other then this?.
From what I understand there is a ModelMatrix for each model instance in _models
what did you mean by "If you are using one ModelMatrix for each model"
is there a way to use multiple models with one ModelMatrix? what are the benefits
of doing so?
Thanks for the answer.
The process you provided is correct.
I rewrote CubismLAppManager::ChangeScene() in the SDK sample here as follows and confirmed the operation. When I ran this, only the second model moved its position.(See the attached image)
Could you please check if the problem still occurs when you perform the same process?
2. I wrote a method for translating the first model when the user click the screen
it is a simple method with only one line:
_models[0]->GetModelMatrix()->TranslateRelative(speed, 0.0f);
but when i start it both models translate and that is my main problem
for example using this line after both models were created:
_models[0]->GetModelMatrix()->TranslateRelative(0.7f, 0.0f);
Thank you for your answer.
I was able to confirm the phenomenon.
We are going to investigate the cause of the problem, so please wait for a while.
I tested the code and everything seems to work fine
P.S. the last comment with the code disappeared for me can you write it again
for future reference.
I found out that the reason is that the instance of CubismMatrix44 used for drawing is not being reset after each loop process.
This can be avoided by rewriting a part of LAppLive2DManager::OnUpdate() as follows
void LAppLive2DManager::OnUpdate() const
{
...
// CubismMatrix44 projection;
csmUint32 modelCount = _models.GetSize();
for (csmUint32 i = 0; i < modelCount; ++i)
{
CubismMatrix44 projection;
...
This fix will be added in a future update of the SDK.
Thanks for the report.