void Transformation::applyInvTransform(Matrix4d& _m) { _m = getInvTransform() *_m; }
void Player::getDamageLocation(const Point3F& in_rPos, const char*& out_rpVert, const char*& out_rpQuad) { const TMat3F& rTrans = getInvTransform(); Point3F newPoint; m_mul(in_rPos, rTrans, &newPoint); float zHeight = (crouching == true) ? data->boxCrouchHeight : data->boxNormalHeight; float zTorso = (crouching == true) ? data->boxCrouchTorsoPercentage : data->boxNormalTorsoPercentage; float zHead = (crouching == true) ? data->boxCrouchHeadPercentage : data->boxNormalHeadPercentage; zTorso *= zHeight; zHead *= zHeight; if (newPoint.z <= zTorso) out_rpVert = "legs"; else if (newPoint.z <= zHead) out_rpVert = "torso"; else out_rpVert = "head"; if (strcmp(out_rpVert, "head") != 0) { if (newPoint.y >= 0.0f) { if (newPoint.x <= 0.0f) { out_rpQuad = "front_left"; } else { out_rpQuad = "front_right"; } } else { if (newPoint.x <= 0.0f) { out_rpQuad = "back_left"; } else { out_rpQuad = "back_right"; } } } else { // Have to do the head noc-tant calculation // float backToFront = getBoundingBox().len_x(); float leftToRight = getBoundingBox().len_y(); float backPoint = backToFront * (data->boxHeadBackPercentage - 0.5); float frontPoint = backToFront * (data->boxHeadFrontPercentage - 0.5); float leftPoint = leftToRight * (data->boxHeadLeftPercentage - 0.5); float rightPoint = leftToRight * (data->boxHeadRightPercentage - 0.5); int index = 0; if (newPoint.y < backPoint) index += 0; else if (newPoint.y <= frontPoint) index += 3; else index += 6; if (newPoint.x < leftPoint) index += 0; else if (newPoint.x <= rightPoint) index += 1; else index += 2; switch (index) { case 0: out_rpQuad = "left_back"; break; case 1: out_rpQuad = "middle_back"; break; case 2: out_rpQuad = "right_back"; break; case 3: out_rpQuad = "left_middle"; break; case 4: out_rpQuad = "middle_middle"; break; case 5: out_rpQuad = "right_middle"; break; case 6: out_rpQuad = "left_front"; break; case 7: out_rpQuad = "middle_front"; break; case 8: out_rpQuad = "right_front"; break; default: AssertFatal(0, "Bad non-tant index"); }; } }
void Transformation::applyInvTransform(Vector3d& _v) { _v = utils::xformHom(getInvTransform(), _v); }
void Transformation::applyInvTransform(Vector3d& _v) { _v = dart_math::xformHom(getInvTransform(), _v); }