-3

everyone. I'm having a little trouble with launching snowballs. I'm working on a plugin where, while a user is holding a snowball, they can sneak to charge a power bar. The player has a scoreboard in the side_bar that has a "power bar" that goes up and down from 1 to 10 while they are snaking. Once they right click to throw the snowball, it launches the ball at a velocity dependent on the users power level. A level of 5 is the default speed, a level of 10 is double the default speed, and a level of 1 is a fifth of the default speed, and the rest fill in that scale accordingly. I do this by multiplying the velocity by powerLevel/5.

This is all working splendidly. Well... kinda...

If the power level is 5 or above, it does what I expect it to do. However, if the power level is below 5 (slower than the default speed), the snowball just drops straight down. Is there a reason this happens? Can it be fixed? Any help on this would be great.

Thanks in advance!

Grzegorz Żur
  • 47,257
  • 14
  • 109
  • 105
tboneblaze
  • 21
  • 1
  • 1
  • 7

2 Answers2

0

based on how much y velocity it has, the snowball will start to drop caused by gravity. to remove this, you would need to keep track of the snowball's y plane with the methods on this thread. Calculate initial velocity to move a set distance with inertia

Community
  • 1
  • 1
Ashley
  • 142
  • 7
0

My guess would be that a fifth of the snowball's velocity is about dropping when you throw it. In order to fix it; you'll need to set the Y level higher so it doesn't fall.

User
  • 129
  • 2
  • 16