Get distance between two entities/positions

Started by RedWirePlatinum on

Topic category: Feature requests and ideas for MCreator

Last seen on 00:54, 24. Mar 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Get distance between two entities/positions

This is something I think would be really useful in a future update, specifically it would help in determining what player is closest to an entity when iterating through all entities. But.. I for the life of me CANNOT figure out how to calculate the distance between two positions. What I want is kind of like how Vector3.Magnitude works in roblox https://create.roblox.com/docs/reference/engine/datatypes/Vector3#Magni…

Last seen on 00:54, 24. Mar 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Update: I know the formula…
Tue, 03/21/2023 - 23:31

Update: I know the formula now, for two positions it would be like this, using (x,y,z) and x2,y2,z2) as an example:

math.sqrt((x-x2)^2 + (y-y2)^2 + (z-z2)^2)

Last seen on 00:54, 24. Mar 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nb4 anyone calls me dumb or …
Tue, 03/21/2023 - 23:43

nb4 anyone calls me dumb or "you learned this in 9th grade" im forgetful ok >:(((((((

Last seen on 23:01, 28. Mar 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks man, I didn't…
Sun, 07/23/2023 - 08:32

Thanks man, I didn't remember this formula ;)