Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Vector3 vs Position

Comments in 'Plugin Development' started by Dinokiller, Jul 5, 2014.

  1. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Why have Vector3 if you have Position? This is a question I've been trying to figure the answer to ever since I started writing plugins for PocketMine-MP. I understand that Vector3 can be used for calculations and such but couldn't you just use Position for all of this?
  2. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    You can use two methods together! Why not? :)
  3. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    You mean combine Position and Vector3 into one class? You're not using the correct terms so I can't understand what you mean.
  4. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    Yep.
  5. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Yeah that I was thinking, there's no point in 2 different objects.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Because using Vector3 is more memory-efficient.
  7. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    Wrong... Position implements X, Y, Z and Level information, this is used when you need to specify coordinates in the specified world.
    Vector3 implements X, Y and Z on "the actual world".
    Check out the code, if you check "$player->teleport(Vector3 $pos, $yaw = false, $pitch = false)", you can see that need Vector3 :p
    Last edited: Jul 6, 2014
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Vector3 is used normally, but if you want to pass the level datum too, use Position. Basically, just use Vector3 unless you want the level datum too.
    iksaku likes this.
  9. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    yup ;)
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You can put position for that, if you want to change world too.

Share This Page

Advertisement