File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -565,7 +565,7 @@ P* Interactive::findNearest(Inter& in, const Npc& to) {
565565 for (auto & i:in.attPos ) {
566566 if (i.user || !i.isAttachPoint ())
567567 continue ;
568- float d = in.qDistanceTo (to,i);
568+ float d = in.qDistTo (to,i);
569569 if (d<dist || p==nullptr ) {
570570 p = &i;
571571 dist = d;
@@ -853,9 +853,9 @@ void Interactive::setDir(Npc &npc, const Tempest::Matrix4x4 &mat) {
853853 npc.setDirection (Tempest::Vec3 (x1-x0, y1-y0, z1-z0));
854854 }
855855
856- float Interactive::qDistanceTo (const Npc &npc, const Interactive::Pos &to) const {
856+ float Interactive::qDistTo (const Npc &npc, const Interactive::Pos &to) const {
857857 auto p = worldPos (to);
858- return npc.qDistTo (p. x ,p. y -npc. translateY (),p. z );
858+ return npc.qDistTo (p);
859859 }
860860
861861Tempest::Matrix4x4 Interactive::nodeTranform (const Npc &npc, const Pos& p) const {
Original file line number Diff line number Diff line change @@ -686,15 +686,9 @@ std::string_view Npc::formerPortalName() {
686686 return mvAlgo.formerPortalName ();
687687 }
688688
689- float Npc::qDistTo (float x1, float y1, float z1) const {
690- float dx=x-x1;
691- float dy=y+translateY ()-y1;
692- float dz=z-z1;
693- return dx*dx+dy*dy+dz*dz;
694- }
695-
696- float Npc::qDistTo (const Tempest::Vec3 pos) const {
697- return qDistTo (pos.x ,pos.y ,pos.z );
689+ float Npc::qDistTo (const Vec3 pos) const {
690+ auto dp = pos - Vec3 (x,y+translateY (),z);
691+ return dp.quadLength ();
698692 }
699693
700694float Npc::qDistTo (const WayPoint *f) const {
@@ -704,7 +698,7 @@ float Npc::qDistTo(const WayPoint *f) const {
704698 }
705699
706700float Npc::qDistTo (const Npc &p) const {
707- return qDistTo (p.x ,p.y +p.translateY (),p.z );
701+ return qDistTo (Vec3 ( p.x ,p.y +p.translateY (),p.z ) );
708702 }
709703
710704float Npc::qDistTo (const Interactive &p) const {
Original file line number Diff line number Diff line change @@ -123,7 +123,6 @@ class Npc final {
123123 auto portalName () -> std::string_view;
124124 auto formerPortalName () -> std::string_view;
125125
126- float qDistTo (float x, float y, float z) const ;
127126 float qDistTo (const Tempest::Vec3 pos) const ;
128127 float qDistTo (const WayPoint* p) const ;
129128 float qDistTo (const Npc& p) const ;
You can’t perform that action at this time.
0 commit comments