benikabocha / saba

OpenGL Viewer (OBJ PMD PMX)
MIT License
446 stars 61 forks source link

Issue in reading PMXModel #30

Closed hax0r31337 closed 2 years ago

hax0r31337 commented 2 years ago

I'm converting your code from C++ to Kotlin, but i see this in your code. https://github.com/benikabocha/saba/blob/51561d091963d46b6584040b2776726752b9f3fd/src/Saba/Model/MMD/PMXModel.cpp#L669-L671 i think it should be the code below, but i can't sure is this right, cuz my C++ skill is bad :(

 limitMin.x = -ikLink.m_limitMax.x; 
 limitMin.y = -ikLink.m_limitMax.y; 
 limitMin.z = ikLink.m_limitMin.z; 
benikabocha commented 2 years ago

Maybe it's a bug.

This is the correct code.

glm::vec3 limitMax = ikLink.m_limitMin * glm::vec3(-1);
glm::vec3 limitMin = ikLink.m_limitMax * glm::vec3(-1);

The reason Min and Max are opposite is to change the coordinate system from left hand to right hand.