mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
rendering,ui: sync selection circle to renderer instance position
The selection circle was positioned using the entity's game-logic interpolator (entity->getX/Y/Z), while the actual M2 model is positioned by CharacterRenderer's independent interpolator (moveInstanceTo). These two systems can drift apart during movement, causing the circle to appear under the wrong position relative to the visible model. Fix: add CharacterRenderer::getInstancePosition / Application::getRenderPositionForGuid and use the renderer's inst.position for XY (with footZ override for Z) so the circle always tracks the rendered model exactly. Falls back to the entity game-logic position when no CharacterRenderer instance exists.
This commit is contained in:
parent
463e3f5ed1
commit
ea9c7e68e7
5 changed files with 48 additions and 5 deletions
|
|
@ -4879,6 +4879,26 @@ bool Application::getRenderFootZForGuid(uint64_t guid, float& outFootZ) const {
|
|||
return renderer->getCharacterRenderer()->getInstanceFootZ(instanceId, outFootZ);
|
||||
}
|
||||
|
||||
bool Application::getRenderPositionForGuid(uint64_t guid, glm::vec3& outPos) const {
|
||||
if (!renderer || !renderer->getCharacterRenderer()) return false;
|
||||
uint32_t instanceId = 0;
|
||||
|
||||
if (gameHandler && guid == gameHandler->getPlayerGuid()) {
|
||||
instanceId = renderer->getCharacterInstanceId();
|
||||
}
|
||||
if (instanceId == 0) {
|
||||
auto pit = playerInstances_.find(guid);
|
||||
if (pit != playerInstances_.end()) instanceId = pit->second;
|
||||
}
|
||||
if (instanceId == 0) {
|
||||
auto it = creatureInstances_.find(guid);
|
||||
if (it != creatureInstances_.end()) instanceId = it->second;
|
||||
}
|
||||
if (instanceId == 0) return false;
|
||||
|
||||
return renderer->getCharacterRenderer()->getInstancePosition(instanceId, outPos);
|
||||
}
|
||||
|
||||
pipeline::M2Model Application::loadCreatureM2Sync(const std::string& m2Path) {
|
||||
auto m2Data = assetManager->readFile(m2Path);
|
||||
if (m2Data.empty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue