asuka-mio / kaimyentitysaba Goto Github PK
View Code? Open in Web Editor NEWA native library used to load MMD models for KAIMyEntity
License: MIT License
A native library used to load MMD models for KAIMyEntity
License: MIT License
现在安装这个Mod需要手动下载和安装很多运行时环境。
这对我没什么影响,但是很麻烦。
而且有些动手能力不强的人,他们自己很难正确安装这个Mod,都被这复杂的安装劝退了.......
可以的话,希望能够添加自动运行时环境下载支持。
或者干脆把所有依赖文件都打包进jar。
这可以有效简化安装过程。
BUG产生原因:当只有最底层的动作活跃的时候(其它层都是nullptr)原动画更新逻辑就没有任何问题
当复数层的动画活跃的时候,前一层更新了动画帧(假设这时候是站立IDLE),更新物理帧头发是按照你站立时候来算的,下一层更新动画帧(假设这一层是弯腰)并叠加,这时候动画骨骼就是呈现弯腰姿态,然后(bug产生)再次更新物理帧,是按照从站立突变到弯腰的过程来计算物理帧的,开始拉扯刚体,之后再到下一个更新周期的时候,前一层又将动画骨骼设置为站立姿态,这时候物理帧更新就会进行从弯腰到站立过程的计算......如此循环就会导致层与层之间动作不一致的时候,发生刚体争抢,表现为头发衣服等抽搐并有明显的往某一个特定点拉扯的现象
解决方法:在updatemodel的时候仅在动画活跃的最上层(最后一个有动画的层)更新物理帧
具体位置
KAIMyEntitySaba.cpp
修改这个方法
void KAIMyEntitySaba::UpdateModel(Model* model)
{
int maxAnim = 0;
double deltaTime = saba::GetTime() - model->prevSabaTime;
model->prevSabaTime = saba::GetTime();
double elapsed = deltaTime;
if (elapsed > PHYSICS_ELAPSED)
elapsed = PHYSICS_ELAPSED;
for (size_t i = 0; i < model->vmdAnimCount; ++i)
{
auto vmdAnim = model->vmdAnims[i];
if (vmdAnim != nullptr)
{
maxAnim = i;
}
}
model->mmdModel->BeginAnimation();
for (size_t i = 0; i < model->vmdAnimCount; ++i)
{
auto vmdAnim = model->vmdAnims[i];
if (vmdAnim != nullptr)
{
double animTime = model->animTimes[i] + deltaTime;
if (animTime * FPS > vmdAnim->GetMaxKeyTime())
animTime = 0.0;
model->animTimes[i] = animTime;
if (i == maxAnim)
{
model->mmdModel->UpdateAllAnimation(vmdAnim, animTime * FPS, elapsed);
}
else
{
model->mmdModel->UpdateAnimation(vmdAnim, animTime * FPS);
}
}
}
model->mmdModel->EndAnimation();
model->mmdModel->Update();
}
MMDModel.cpp
添加这个重载
void MMDModel::UpdateAnimation(VMDAnimation* vmdAnim, float vmdFrame)
{
if (vmdAnim != nullptr)
{
vmdAnim->Evaluate(vmdFrame);
}
UpdateMorphAnimation();
UpdateNodeAnimation(false);
}
Github的排版好难用
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.