Get distance between two entities/positions

Started by RedWirePlatinum on

Topic category: Feature requests and ideas for MCreator

Active 4 days ago
Joined May 2022
Points:
799

User statistics:

  • Modifications: 1
  • Forum topics: 43
  • Wiki pages: 0
  • MCreator plugins: 2
  • Comments: 167
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…

Active 4 days ago
Joined May 2022
Points:
799

User statistics:

  • Modifications: 1
  • Forum topics: 43
  • Wiki pages: 0
  • MCreator plugins: 2
  • Comments: 167
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)

Active 4 days ago
Joined May 2022
Points:
799

User statistics:

  • Modifications: 1
  • Forum topics: 43
  • Wiki pages: 0
  • MCreator plugins: 2
  • Comments: 167
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 >:(((((((

Active 1 month ago
Joined Jan 2023
Points:
380

User statistics:

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

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