@@ -252,6 +252,23 @@ void PlayerControl::onRotateMouse(float dAngleX, float dAngleY) {
252252 rotMouseY += dAngleY;
253253 }
254254
255+ void PlayerControl::drawVobRay (DbgPainter& p) const {
256+ auto w = Gothic::inst ().world ();
257+ if (w==nullptr || w->player ()==nullptr )
258+ return ;
259+ auto pl = w->player ();
260+ auto focus = findFocus (¤tFocus);
261+ if (focus.interactive !=nullptr ) {
262+ focus.interactive ->drawVobRay (p, *pl);
263+ }
264+ if (focus.item !=nullptr ) {
265+ focus.item ->drawVobRay (p, *pl);
266+ }
267+ if (focus.npc !=nullptr ) {
268+ pl->drawVobRay (p, *focus.npc );
269+ }
270+ }
271+
255272void PlayerControl::tickFocus () {
256273 currentFocus = findFocus (¤tFocus);
257274 setTarget (currentFocus.npc );
@@ -358,7 +375,7 @@ void PlayerControl::moveFocus(FocusAction act) {
358375 return ;
359376
360377 auto vp = c->viewProj ();
361- auto pos = currentFocus.npc ->position ()+ Tempest::Vec3 ( 0 ,currentFocus. npc -> translateY (), 0 );
378+ auto pos = currentFocus.npc ->centerPosition ( );
362379 vp.project (pos);
363380
364381 Npc* next = nullptr ;
@@ -367,7 +384,7 @@ void PlayerControl::moveFocus(FocusAction act) {
367384 auto npc = w->npcById (i);
368385 if (npc->isPlayer ())
369386 continue ;
370- auto p = npc->position ()+ Tempest::Vec3 ( 0 ,npc-> translateY (), 0 );
387+ auto p = npc->centerPosition ( );
371388 vp.project (p);
372389
373390 if (std::abs (p.x )>1 .f || std::abs (p.y )>1 .f || p.z <0 .f )
@@ -481,7 +498,7 @@ void PlayerControl::marvinO() {
481498 w->setPlayer (target);
482499 }
483500
484- Focus PlayerControl::findFocus (Focus* prev) {
501+ Focus PlayerControl::findFocus (const Focus* prev) const {
485502 auto w = Gothic::inst ().world ();
486503 auto c = Gothic::inst ().camera ();
487504 if (w==nullptr )
0 commit comments