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. Offline

### CasperTheGhostNew Member

Joined:
Jan 14, 2015
Posts:
4
Minecraft User:
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. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,294
Plugins:
11
Minecraft User:
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. Offline

### CasperTheGhostNew Member

Joined:
Jan 14, 2015
Posts:
4
Minecraft User:
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. Offline

### PEMapModderNotable MemberPlugin Developer

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

### CasperTheGhostNew Member

Joined:
Jan 14, 2015
Posts:
4
Minecraft User:
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. Offline

### PEMapModderNotable MemberPlugin Developer

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

### CasperTheGhostNew Member

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

Advertisement