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

Vector3 Problem

Comments in 'Plugin Development' started by CasperTheGhost, Mar 30, 2015.

  1. CasperTheGhost
    Offline

    CasperTheGhost New Member

    Joined:
    Jan 14, 2015
    Posts:
    4
    Minecraft User:
    Casper
    So i've had this small problem where when i set a vector3 to anything above -5, it wont work.
    Like if i set a vector3 to -1, -2, -3, -4, it wont work.
    Any ideas?
    example
    $sender->setMotion($jump = new Vector3($x = 0, $y = -2, $z = 0));
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You just need to do new Vector3(0, -2, 0) without defining $x, $y and $z.

    What happens if y is larger than 0?
  3. CasperTheGhost
    Offline

    CasperTheGhost New Member

    Joined:
    Jan 14, 2015
    Posts:
    4
    Minecraft User:
    Casper
    When y is larger than 0, it makes the players y value decrease. That's why I set it to -5.
    When I set it to -5 the player flys up really high.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No it shouldn't be like that. You did something wrong.
  5. CasperTheGhost
    Offline

    CasperTheGhost New Member

    Joined:
    Jan 14, 2015
    Posts:
    4
    Minecraft User:
    Casper
    Well what do you think I did wrong?
    All I did was a simple command to test setMotion
    Example
    Public function onCommand(/*all the stuff in here i don't wanna type*/){
    if(strtolower($cmd->getName('jump'))){
    $sender->setMotion($jump = new Vector3($x = 0, $y = -2, $z = 0));
    }
    }

    Revised
    Public function onCommand(/*all the stuff in here i don't wanna type*/){
    if(strtolower($cmd->getName('jump'))){
    $sender->setMotion($jump = new Vector3(0, 2, 0));
    }
    }
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Idk. The revised version should make the player feel knocked from downwards.
    CasperTheGhost likes this.
  7. CasperTheGhost
    Offline

    CasperTheGhost New Member

    Joined:
    Jan 14, 2015
    Posts:
    4
    Minecraft User:
    Casper
    Thanks for your help.

Share This Page

Advertisement