Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!
RuneMate will permanently shut down on August 7, 2026
due to events outside our control. You can continue using RuneMate until this date after which it will no longer be available. Thank you to everyone that contributed to RuneMate's success and to the community for the opportunity to serve you all these years.

  • Learn about RuneMate Vault and how its zero knowledge local encryption already protects your sensitive information.
  • Edit or delete your RuneMate account from your Account Settings.
  • All account upgrade subscriptions have been cancelled. No action required.

Resolved Distance bug

Joined
Apr 18, 2015
Messages
408
@Cloud @Arbiter
qm9OR6T.png


boolean Dist = coordinate1.equals(coordinate2));
double Realdist = coordinate1.distanceTo(coordinate2);

@SlashnHax pointed out that the value for Realdist in the picture is the max double.
RVJce6t.png


To me it's logical that dist returns false too since the distance is not zero.

Temporary fixed it by comparing the x/y values.
 
Last edited:
Engineer
Joined
Jul 28, 2013
Messages
2,776
Conditions where it could return Double.MAX_VALUE
1) The start or destination entity are equal to null
2) start.getArea() or destination.getArea() return null
3) startArea.getCenter() or destinationArea.getCenter() returns null, or the planes of the center coordinates don't match.

Can you test all of these conditions for me and see if any don't match? Also regarding .equals not matching, the condition is that they're both instances of Coordinate and that their hashcode's match.
 
Last edited:
Joined
Apr 18, 2015
Messages
408
Conditions where it could return Double.MAX_VALUE
1) The start or destination entity are equal to null
2) start.getArea() or destination.getArea() return null
3) startArea.getCenter() or destinationArea.getCenter() returns null, or the planes of the center coordinates don't match.

Can you test all of these conditions for me and see if any don't match?
I'm gonna guess it was a caching problem since sometimes getPosition() returned null as well(as in while doing the floor the object got de-cached, and when requesting the old gameobject it didn't exist anymore).
I fixed it thanks to @Aidden by storing the location instead of the gameobject when constructing my Door class and doing GameObjects#getLoadedAt(previouslyStoredLocation)
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
I'm gonna guess it was a caching problem since sometimes getPosition() returned null as well(as in while doing the floor the object got de-cached, and when requesting the old gameobject it didn't exist anymore).
I fixed it thanks to @Aidden by storing the location instead of the gameobject when constructing my Door class and doing GameObjects#getLoadedAt(previouslyStoredLocation)
So just to confirm, it was a bug in your code.
 
Top