So I've created a gun a while back and it works, however even though it hits the target you're looking at it looks like the arrow is going in a other direction, how can I stop this from happening? I tried googleing, testing and even looking at code of other gun plugins but I can't figure out how to make this work. Here is my code: Code (Text): Arrow projectile = player.launchProjectile(Arrow.class); Vector velocity = player.getLocation().getDirection().multiply(10.0D); projectile.setVelocity(velocity); projectile.setMetadata("Gun Used", new StringMetadata(name)); projectile.setMetadata("user", new StringMetadata(player.getName())); PlayerData data = DataManager.getPlayerData(player.getUniqueId()); ServerData.addArrowsTrails(projectile, data.selectedArrowTrail()); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_FIREWORK_BLAST, 1.5f, .8f); player.setMetadata("Gun cool down", new StringMetadata("Gun cool down")); Snowball sb = player.launchProjectile(Snowball.class); projectile.setGravity(false); sb.setGravity(false); projectile.setPassenger(sb); Problem: Thank you.
How is that normal? You can see where it looks like the arrow is and where it actually hits the glass. And even if it is, how would I fix this?
Oh lol, you have to have the velocity under 3 I think because it just messes up. Maybe add like a delay to removing the block at the cursor. Or you could do some math and set the velocity to the length of the block
Glassblocks are broken when the arrow (bullet) hits it. As you can see the arrow actually hits the glass because I'm looking at it. However, visually it looks like the arrow is going to the left when its not.
If projectile goes faster than 4.0F then it will make curve either to left or right, but it is only visual so projectile actually goes straight.
Seems unlikely since the weird behavior looks to be a client problem... Maybe let us know what server it was, or if you have a video.
Pretty sure they don't. Take for example hypixel. They just draw a line of particles and get the line of sight etc.
I'm pretty sure Quake doesn't use fireworks Seriously, though, I don't play Hypixel so have no idea, but I'd imagine they just have their own custom projectiles. It's not that hard and ends up working out much better than trying to make an arrow (or snowball, firework, whatever) behave like a bullet.